AaronKFC / iRDPG-for-Quantitative-Trading-on-Stock-Index-Futures

Apache License 2.0
17 stars 2 forks source link

File "D:\Anaconda3\lib\site-packages\pandas\core\indexes\range.py", line 357, in get_loc raise KeyError(key) from err KeyError: 195 #3

Open wangchong282 opened 1 year ago

wangchong282 commented 1 year ago

你好,當我用自己的數據集進行訓練時總是會在運行中途報錯,比如我的一天的分鐘數是195個,它會報如下錯誤:Traceback (most recent call last): File "D:\Anaconda3\lib\site-packages\pandas\core\indexes\range.py", line 355, in get_loc return self._range.index(new_key) ValueError: 195 is not in range

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "D:\jupyterFile\DQN2\self-iRDPG-for-Quantitative-Trading-on-Stock-Index-Futures-main\main_train.py", line 127, in rdpg.train(args.train_num_episodes, args.checkpoint, args.debug) File "D:\jupyterFile\DQN2\self-iRDPG-for-Quantitative-Trading-on-Stock-Index-Futures-main\rdpg.py", line 169, in train action_bc, next_state, reward, done, infos = self.env.step(np.argmax(action)) File "D:\jupyterFile\DQN2\self-iRDPG-for-Quantitative-Trading-on-Stock-Index-Futures-main\environment.py", line 230, in step action_bc = self.mktOb['phtAction'][self.stepIdx + (self.stateWinlen -1)] File "D:\Anaconda3\lib\site-packages\pandas\core\series.py", line 882, in getitem return self._get_value(key) File "D:\Anaconda3\lib\site-packages\pandas\core\series.py", line 989, in _get_value loc = self.index.get_loc(label) File "D:\Anaconda3\lib\site-packages\pandas\core\indexes\range.py", line 357, in get_loc raise KeyError(key) from err KeyError: 195