我的python代码:
df=pd.read_csv("path")
by_day=df.groupby('visit_date').first_name.count()
# visit_date and first_name are columns in my data
plt.figure(figsize=(16,4))
ax=plt.subplot()
plt.plot(by_day.values,marker='o',markersize=8,linewidth=3)
plt.ylabel("Number of visits")
ax.set_xticks(range(len(by_day))[::8])
ax.set_xticklabels(by_day.index[::8],rotation=45)
plt.show()
如何按升序对date
列进行排序,以将其显示在图的x轴上?