AI4Finance-Foundation / AI4Finance-Foundation/FinRL-Tutorials

ValueError: If using all scalar values, you must pass an index || Deep Reinforcement Learning for Stock Trading from Scratch: Multiple Stock Trading Using Ensemble Strategy

Đang mở
#63 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
bug
Ngôn ngữ chính
Jupyter Notebook
Star
1.2k
Fork
435
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

Error while executing [FinRL_Ensemble_StockTrading_ICAIF_2020.ipynb](https://github.com/AI4Finance-Foundation/FinRL-Tutorials/blob/master/2-Advance/FinRL_Ensemble_StockTrading_ICAIF_2020.ipynb).
While running the below block of code:
```
df_summary = ensemble_agent.run_ensemble_strategy(A2C_model_kwargs,
PPO_model_kwargs,
DDPG_model_kwargs,
timesteps_dict)
```

____________________________________________________________________________________________________________________________________________

ValueError Traceback (most recent call last)
[](https://localhost:8080/#) in ()
----> 1 df_summary = ensemble_agent.run_ensemble_strategy(A2C_model_kwargs,
2 PPO_model_kwargs,
3 DDPG_model_kwargs,
4 timesteps_dict)

[/usr/local/lib/python3.10/site-packages/finrl/agents/stablebaselines3/models.py](https://localhost:8080/#) in run_ensemble_strategy(self, A2C_model_kwargs, PPO_model_kwargs, DDPG_model_kwargs, timesteps_dict)
666 )
667 # print("Used Model: ", model_ensemble)
--> 668 last_state_ensemble = self.DRL_prediction(
669 model=model_ensemble,
670 name="ensemble",

[/usr/local/lib/python3.10/site-packages/finrl/agents/stablebaselines3/models.py](https://localhost:8080/#) in DRL_prediction(self, model, name, last_state, iter_num, turbulence_threshold, initial)
319 last_state = trade_env.render()
320
--> 321 df_last_state = pd.DataFrame({"last_state": last_state})
322 df_last_state.to_csv(f"results/last_state_{name}_{i}.csv", index=False)
323 return last_state

[/usr/local/lib/python3.10/site-packages/pandas/core/frame.py](https://localhost:8080/#) in __init__(self, data, index, columns, dtype, copy)
707 elif isinstance(data, dict):
708 # GH#38939 de facto copy defaults to False only in non-dict cases
--> 709 mgr = dict_to_mgr(data, index, columns, dtype=dtype, copy=copy, typ=manager)
710 elif isinstance(data, ma.MaskedArray):
711 from numpy.ma import mrecords

[/usr/local/lib/python3.10/site-packages/pandas/core/internals/construction.py](https://localhost:8080/#) in dict_to_mgr(data, index, columns, dtype, typ, copy)
479 arrays = [x.copy() if hasattr(x, "dtype") else x for x in arrays]
480
--> 481 return arrays_to_mgr(arrays, columns, index, dtype=dtype, typ=typ, consolidate=copy)
482
483

[/usr/local/lib/python3.10/site-packages/pandas/core/internals/construction.py](https://localhost:8080/#) in arrays_to_mgr(arrays, columns, index, dtype, verify_integrity, typ, consolidate)
113 # figure out the index, if necessary
114 if index is None:
--> 115 index = _extract_index(arrays)
116 else:
117 index = ensure_index(index)

[/usr/local/lib/python3.10/site-packages/pandas/core/internals/construction.py](https://localhost:8080/#) in _extract_index(data)
643
644 if not indexes and not raw_lengths:
--> 645 raise ValueError("If using all scalar values, you must pass an index")
646
647 if have_series:

ValueError: If using all scalar values, you must pass an index

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.