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 #63
Labels
bug
Something isn't working
Error while executing FinRL_Ensemble_StockTrading_ICAIF_2020.ipynb.
While running the below block of code:
ValueError Traceback (most recent call last)
in <cell line: 1>()
----> 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 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 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 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 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 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 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
The text was updated successfully, but these errors were encountered: