Advertisement
korenizla

Untitled

Sep 14th, 2022
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. actual_platforms = ["pc", "xone", "3ds"]
  2.  
  3.  
  4. for platform in actual_platforms:
  5. data = game_stat_actual.loc[(game_stat_actual['platform'] == platform)&
  6. (~game_stat_actual['user_score'].isna())][["critic_score","user_score","total_sales"]]
  7. Q1, Q3 = data["total_sales"].quantile([0.25, 0.75])
  8. IQR = Q3-Q1
  9. data = data.query("@Q1-1.5*@IQR <= total_sales <= @Q3+1.5*@IQR")
  10.  
  11. labels = ["Оценки критиков", "Оценки пользователей", "Продажи"]
  12. display(data.corr().round(2).set_axis(labels, axis=1, inplace=False).set_axis(labels, axis=0, inplace=False).rename_axis(platform.upper(), axis=0, inplace=False))
  13.  
  14. line_kws = {"color": "r"}
  15. scatter_kws = {"alpha":0.5, "color": "w", "edgecolors":"blue"}
  16. plot_kws = {"scatter_kws": scatter_kws, "line_kws":line_kws}
  17.  
  18. diag_kws = {"color": "blue"}
  19.  
  20. g = sns.pairplot(data=data.dropna(), kind="reg", plot_kws=plot_kws, diag_kws=diag_kws)
  21. plt.gcf().set_size_inches(16,8)
  22.  
  23. font_size = 14
  24. labels = ["Оценки критиков", "Оценки пользователей", "Продажи"]
  25.  
  26. for ax1, ax2, label in zip(g.axes.ravel(order="F"), g.axes[::-1].ravel(order="C"), labels):
  27. ax1.set_ylabel(label, fontsize=font_size)
  28. ax2.set_xlabel(label, fontsize=font_size)
  29.  
  30. g.fig.subplots_adjust(hspace=0.02, wspace=0.01)
  31. g.fig.suptitle(platform.upper(), fontsize=20)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement