Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

运行main.py时,add_technical_indicator在计算cci_30指标时抛出异常:float division by zero #3

Open
fffanrrr opened this issue Jan 4, 2024 · 1 comment

Comments

@fffanrrr
Copy link

fffanrrr commented Jan 4, 2024

Traceback (most recent call last):
File "D:\Code\StockFormer-main\code\Transformer\main.py", line 88, in
data = data_type_dict[args.data_type](
File "D:\Code\StockFormer-main\code\Transformer\data\stock_data_handle.py", line 35, in init
self.read_data()
File "D:\Code\StockFormer-main\code\Transformer\data\stock_data_handle.py", line 62, in read_data
df = fe.preprocess_data(df)
File "D:\Code\StockFormer-main\code\Transformer\utils\preprocess.py", line 86, in preprocess_data
df = self.add_technical_indicator(df)
File "D:\Code\StockFormer-main\code\Transformer\utils\preprocess.py", line 212, in add_technical_indicator
indicator_df[["tic", "date", indicator]], on=["tic", "date"], how="left"
File "C:\Users\lenovo\anaconda3\lib\site-packages\pandas\core\frame.py", line 3511, in getitem
indexer = self.columns._get_indexer_strict(key, "columns")[1]
File "C:\Users\lenovo\anaconda3\lib\site-packages\pandas\core\indexes\base.py", line 5782, in _get_indexer_strict
self._raise_if_missing(keyarr, indexer, axis_name)
File "C:\Users\lenovo\anaconda3\lib\site-packages\pandas\core\indexes\base.py", line 5842, in _raise_if_missing
raise KeyError(f"None of [{key}] are in the [{axis_name}]")
KeyError: "None of [Index(['tic', 'date', 'cci_30'], dtype='object')] are in the [columns]"

@fffanrrr
Copy link
Author

solved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant