AI4Finance-Foundation / AI4Finance-Foundation/FinRL_Podracer
ValueError: arrays must be the same length
- 主要語言
- Python
- 星號
- 507
- 分支
- 121
- PR 合併指標
- 30 天內沒有已合併 PR
描述
I'm running the demo notebook unmodified on Ubuntu 20.04 machine with one GPU, everything is pip installed properly, but I keep getting this error below no matter what I do. It works in Colab but not locally. Why? How can I fix this?
| load data: .//StockTradingEnv_trading_data.df
| YahooDownloader: finish processing date list
| GPU id: 0, cwd: ./AgentPPO/StockTradingEnv-v2_0
Loaded act: ./AgentPPO/StockTradingEnv-v2_0
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
in
6 args.init_before_training()
7
----> 8 prediction = args.env.trade_prediction(args, torch)
~/Dropbox/Code/work/stocks_boredhumans/Elegant-FinRL/elegant_finrl/env.py in trade_prediction(self, args, _torch)
266 # print(len(self.date_list))
267 # print(self.date_list)
--> 268 df_account_value = pd.DataFrame({'date':self.date_list,'account_value':episode_returns})
269 return df_account_value
270
/usr/local/lib/python3.8/dist-packages/pandas/core/frame.py in __init__(self, data, index, columns, dtype, copy)
527
528 elif isinstance(data, dict):
--> 529 mgr = init_dict(data, index, columns, dtype=dtype)
530 elif isinstance(data, ma.MaskedArray):
531 import numpy.ma.mrecords as mrecords
/usr/local/lib/python3.8/dist-packages/pandas/core/internals/construction.py in init_dict(data, index, columns, dtype)
285 arr if not is_datetime64tz_dtype(arr) else arr.copy() for arr in arrays
286 ]
--> 287 return arrays_to_mgr(arrays, data_names, index, columns, dtype=dtype)
288
289
/usr/local/lib/python3.8/dist-packages/pandas/core/internals/construction.py in arrays_to_mgr(arrays, arr_names, index, columns, dtype, verify_integrity)
78 # figure out the index, if necessary
79 if index is None:
---> 80 index = extract_index(arrays)
81 else:
82 index = ensure_index(index)
/usr/local/lib/python3.8/dist-packages/pandas/core/internals/construction.py in extract_index(data)
399 lengths = list(set(raw_lengths))
400 if len(lengths) > 1:
--> 401 raise ValueError("arrays must all be same length")
402
403 if have_dicts:
ValueError: arrays must all be same length
貢獻指南
這個儲存庫沒有索引到貢獻指南
研究方向
Start with the demo notebook and reproduce the local run on Ubuntu 20.04, then inspect elegant_finrl/env.py at trade_prediction around line 268. Compare the lengths of self.date_list and episode_returns before the pandas DataFrame construction; done means the local demo completes without the same-length ValueError and preserves the expected prediction output.
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- pandas, python, pytorch
- 領域
- data, machine-learning
- Issue 類型
- 缺陷
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 25/100