Skip to main content
 首页 » 编程设计

python之从折线图中删除小数

2024年12月31日9jillzhang

<分区>

我的年份数据在表格上显示时是一个整数,但当我将它输入到 x 轴下的折线图中时,它会在一年中的不同时间自行拆分。谁能帮我把它归入年份本身?

这是我当前的代码:

 df.plot( x = "Year", kind="line", figsize = (10,5), legend = True) 
 plt.ticklabel_format(style="plain", axis="y") 
 plt.xlabel("Year") 
 plt.ylabel("Profit") 
 plt.title("Yearly Profit") 
 plt.show()