AI4Finance-Foundation / AI4Finance-Foundation/FinRL-Tutorials

Error when running "e_train_gym = StockTradingEnv(df = train, **env_kwargs)",AttributeError: 'numpy.float64' object has no attribute 'values'

Open
#42 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Jupyter Notebook
Stars
1.2k
Forks
435
PR merge metrics
No merged PRs in 30d

Description

File: Stock_NeurlPS2018_Train.ipynb

File ~/anaconda3/lib/python3.8/site-packages/finrl/meta/env_stock_trading/env_stocktrading.py:404, in StockTradingEnv._initiate_state(self)
398 if self.initial:
399 # For Initial State
400 if len(self.df.tic.unique()) > 1:
401 # for multiple stock
402 state = (
403 [self.initial_amount]
--> 404 + self.data.close.values.tolist()
405 + self.num_stock_shares
406 + sum(
407 (
408 self.data[tech].values.tolist()
409 for tech in self.tech_indicator_list
410 ),
411 [],
412 )
413 ) # append initial stocks_share to initial state, instead of all zero
414 else:
415 # for single stock
416 state = (
417 [self.initial_amount]
418 + [self.data.close]
419 + [0] * self.stock_dim
420 + sum(([self.data[tech]] for tech in self.tech_indicator_list), [])
421 )

AttributeError: 'numpy.float64' object has no attribute 'values'

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.