Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- actual_platforms = ["pc", "xone", "3ds"]
- for platform in actual_platforms:
- data = game_stat_actual.loc[(game_stat_actual['platform'] == platform)&
- (~game_stat_actual['user_score'].isna())][["critic_score","user_score","total_sales"]]
- Q1, Q3 = data["total_sales"].quantile([0.25, 0.75])
- IQR = Q3-Q1
- data = data.query("@Q1-1.5*@IQR <= total_sales <= @Q3+1.5*@IQR")
- labels = ["Оценки критиков", "Оценки пользователей", "Продажи"]
- 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))
- line_kws = {"color": "r"}
- scatter_kws = {"alpha":0.5, "color": "w", "edgecolors":"blue"}
- plot_kws = {"scatter_kws": scatter_kws, "line_kws":line_kws}
- diag_kws = {"color": "blue"}
- g = sns.pairplot(data=data.dropna(), kind="reg", plot_kws=plot_kws, diag_kws=diag_kws)
- plt.gcf().set_size_inches(16,8)
- font_size = 14
- labels = ["Оценки критиков", "Оценки пользователей", "Продажи"]
- for ax1, ax2, label in zip(g.axes.ravel(order="F"), g.axes[::-1].ravel(order="C"), labels):
- ax1.set_ylabel(label, fontsize=font_size)
- ax2.set_xlabel(label, fontsize=font_size)
- g.fig.subplots_adjust(hspace=0.02, wspace=0.01)
- g.fig.suptitle(platform.upper(), fontsize=20)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement