时间序列图显示为垂直线

时间:2018-09-25 18:42:18

标签: python pandas datetime matplotlib quandl

import pandas as pd
import quandl as qndl
import datetime as dt
import matplotlib.pyplot as plt
import QuandlAPIKey                   (My QUANDL API KEY, IGNORE THIS.)

data = qndl.get_table('AUSBS/D')

dataframe = pd.DataFrame(data)
sorteddataframe = dataframe.sort_values(by='date') 

dfdate = sorteddataframe[['date']]
dfvalue = sorteddataframe[['value']]
dfx = dfdate
dfy = dfvalue

values_to_read = 100
print(sorteddataframe.head(values_to_read))

plt.plot(dfx.head(values_to_read),dfy.head(values_to_read))
plt.xlabel("Years")
plt.ylabel("Stock Values (Scaled down by 10%)")
plt.show()

我已经检查了数据框(dfx,dfy,sorteddataframe),它们都已正确排序,但是生成的图形只是一条简单的垂直线。图片已发布。

Picture

0 个答案:

没有答案