我想绘制以下数据
>>> AllSummary
upload_date Gross Loan Amount NewPerfColumn
0 2018-02-19 1.532472e+11 2.624765e+08
1 2018-03-01 1.475863e+11 1.361267e+08
2 2018-03-12 1.376221e+11 1.133450e+08
如下所示,列" upload_date"肯定被认为是一个日期
AllSummary.dtypes
upload_date datetime64[ns]
Gross Loan Amount float64
NewPerfColumn float64
dtype: object
但是当我绘制数据时,它显示x-xis为数字(而不是日期):代码在下面
x=AllSummary['upload_date']
y1 =AllSummary['Gross Loan Amount']
y2 =AllSummary['NewPerfColumn']
fig, ax1 = plt.subplots()
ax2 = ax1.twinx()
ax1.plot(x, y1, 'g-')
ax2.plot(x, y2, 'b-')
ax1.set_xlabel('Date')
ax1.set_ylabel('Gross Loan Amount', color='g')
ax2.set_ylabel('Performance', color='b')
plt.show()
为什么会这样?