【发布时间】:2021-12-10 05:55:16
【问题描述】:
我尝试使用此数据框显示直方图。
gr_age weighted_cost
0 1 2272.985462
1 2 2027.919360
2 3 1417.617779
3 4 946.568598
4 5 715.731002
5 6 641.716770
我想使用gr_age 列作为 X 轴,weighted_cost 作为 Y 轴。这是我正在使用 Excel 查找的示例:
我尝试使用以下代码和discrete=True,但它给出了另一个结果,并且我没有使用 displot 做得更好。
sns.histplot(data=df, x="gr_age", y="weighted_cost")
plt.show()
感谢您的想法!
【问题讨论】:
标签: python pandas dataframe matplotlib seaborn