数据(节选):

Python新手求助帖

import matplotlib.pyplot as plt
import pandas as pd
df['starttime'] = pd.to_datetime(df['starttime'])
df.index = df['starttime']
df1 = df.resample('M').apply(len)

y = df1['bikeid']
x = df1.index
plt.plot(y)
plt.show()

将原数据按月份进行了汇总计数,并画图

Python新手求助帖

Python新手求助帖

求问为何三个坐标点,x轴却出现这么多个日期?明明我设置了x轴等于df1.index,求指教,谢谢!

 

相关文章: