import pandas as pd from alpha_vantage.timeseries import TimeSeriesfrom alpha_vantage.techindicators import TechIndicators ts = TimeSeries(key=api_key, output_format = 'pandas')ti = TechIndicators(key=api_key, output_format='pandas')data1, meta_data1 = ts.get_intraday(symbol = 'GOOGL' ,interval = '5min', outputsize = 'full')data2, meta_data2 = ti.get_bbands(symbol = 'GOOGL' , interval='5min', time_period=60)data = pd.concat([data1, data2], axis=1, sort=False)data = data.rename(columns={'1. open': 'Open', '2. high': 'High', '3. low': 'Low', '4. close': 'Close'}, inplace = True)data.head()在上面的代碼中,我從 alpha vantage api 導入數據。但是出現了上面的錯誤。請幫我!
1 回答

神不在的星期二
TA貢獻1963條經驗 獲得超6個贊
當您使用 時inplace=True
,該rename
函數會就地執行操作,并且不會返回包含重命名列的數據框。相反,它返回None
,然后將其分配給data
- 使其成為 NoneType 對象。由于data
不再是 df,因此調用head()
它會導致您遇到錯誤。
添加回答
舉報
0/150
提交
取消