我尝试的某种“应该”是有效的;但它不是。
我已经使用"alpha_vantage“Python库查询了"Alpha Vantage”API。下面是我的代码。我请求按日期排序;但是,从df.head()中的输出可以看出,按日期排序的方向是错误的。然而,剧情正在朝着正确的方向发展。
df, meta_data = ts.get_daily(symbol='AAPL',outputsize=365)
df['4. close'].plot()
plt.title('Intraday Times Series for the AAPL stock (5 min)')
# Attempting sort here! Also I've tried df.sort_values(by=['date'])
df.sort_values(by=['date'])
print(plt.show())
print(df.head())输出:
None
date 1. open 2. high 3. low 4. close 5. volume
2019-11-13 261.13 262.95 261.07 262.4307 3284781.0
2019-11-12 261.55 262.79 260.92 261.9600 21826100.0
2019-11-11 258.30 262.47 258.28 262.2000 20455300.0
2019-11-08 258.69 260.44 256.85 260.1400 17496600.0
2019-11-07 258.74 260.35 258.11 259.4300 23735100.0发布于 2019-11-13 23:45:33
df = df.sort_values(by=['date'])
应该把它做好
https://stackoverflow.com/questions/58840655
复制相似问题