为什么mathplotlib要在图中添加日期。例如:2023-02-15
df = pd.DataFrame()
df['YearMonth'] = [202303,202302,202301,202212,202211]
df['total_burgers'] = [800,900,1200,1100,1000]
df['YearMonth'] = pd.to_datetime(df['YearMonth'], format='%Y%m')
x=df['YearMonth']
y1=df['total_burgers']
plt.plot(x, y1)
1条答案
按热度按时间pzfprimi1#
Matplotlib会自动选择可以像这样定义的xtick。