AI4Finance-Foundation / AI4Finance-Foundation/FinRL-Meta

China_A_share_market_tushare AttributeError

未关闭
#283 4 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
bug
主要语言
Python
星标
1.9k
派生
751
PR 合并指标
30 天内没有已合并 PR

描述

When I run China_A_share_market_tushare.ipynb, the following error came accross. It seems the dataframe has no attribute date.

---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[42], line 3
1 env_kwargs = { "stock_dim": stock_dimension, "hmax": 1000, "initial_amount": 1000000, "buy_cost_pct": 6.87e-5, "sell_cost_pct": 1.0687e-3, "reward_scaling": 1e-4, "state_space": state_space, "action_space": stock_dimension, "tech_indicator_list": config.INDICATORS, "print_verbosity": 1, "initial_buy": True, "hundred_each_trade": True }
----> 3 e_train_gym = StockTradingEnv(df=train, **env_kwargs)

File F:\FinRL-Tutorials\1-Introduction\meta\env_stock_trading\env_stocktrading_China_A_shares.py:82, in StockTradingEnv.__init__(self, df, stock_dim, hmax, initial_amount, buy_cost_pct, sell_cost_pct, reward_scaling, state_space, action_space, tech_indicator_list, turbulence_threshold, make_plots, print_verbosity, day, initial, previous_state, model_name, mode, iteration, initial_buy, hundred_each_trade)
80 self.rewards_memory = []
81 self.actions_memory = []
---> 82 self.date_memory = [self._get_date()]
83 self._seed()

File F:\FinRL-Tutorials\1-Introduction\meta\env_stock_trading\env_stocktrading_China_A_shares.py:451, in StockTradingEnv._get_date(self)
449 def _get_date(self):
450 if len(self.df.tic.unique()) > 1:
--> 451 date = self.data.date.unique()[0]
452 else:
453 date = self.data.date

File D:\Anaconda\envs\stock\lib\site-packages\pandas\core\generic.py:5902, in NDFrame.__getattr__(self, name)
5895 if (
5896 name not in self._internal_names_set
5897 and name not in self._metadata
5898 and name not in self._accessors
5899 and self._info_axis._can_hold_identifiers_and_holds_name(name)
5900 ):
5901 return self[name]
-> 5902 return object.__getattribute__(self, name)

AttributeError: 'DataFrame' object has no attribute 'date'

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。