print(vol_df)
avg_vol_df=pd.Series(vol_df).rolling(window=20).mean()
vol_df的內容:
成交股數
0 6668624093
1 7000414730
2 7666161224
3 5882916889
4 6301315220
5 4240619512
6 5152771960
7 5604573262
8 5632000282
9 4141531366
10 5099018549
11 5269035601
12 5587861806
13 4516673303
14 4591419535
15 3914740328
16 4347751931
17 4745714862
18 4911766203
19 4901183056
avg_vol_df出現
"name": "ValueError",
"message": "The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().",
請問該如何解決 謝謝
試試
avg_vol_df=pd.Series(vol_df['成交股數']).rolling(window=20).mean()