Skip to content

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

Open
@bladering

Description

@bladering

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'

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions