-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Open
Labels
questionFurther information is requestedFurther information is requested
Description
❓ Questions and Help
We sincerely suggest you to carefully read the documentation of our library as well as the official paper. After that, if you still feel puzzled, please describe the question clearly under this issue.
in examples/rl_order_execution/scripts/gen_training_orders.py
, I got two error:
df["date"] = df["datetime"].dt.date.astype("datetime64")
this will throw
TypeError: Casting to unit-less dtype 'datetime64' is not supported. Pass e.g. 'datetime64[ns]' instead.
and after I fix this problem, got another one
order_all = pd.DataFrame(df.groupby(level=(2, 0), group_keys=False).mean().dropna())
IndexError: Too many levels: Index has only 2 levels, not 3
and I change this code to
order_all = pd.DataFrame(df.groupby(level=(1, 0), group_keys=False).mean().dropna())
when traing model, get this error
Traceback (most recent call last):
File "/opt/anaconda3/envs/qlib38/lib/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
File "/opt/anaconda3/envs/qlib38/lib/python3.8/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "/opt/anaconda3/envs/qlib38/lib/python3.8/site-packages/qlib/rl/utils/data_queue.py", line 181, in _producer
for data in dataloader:
File "/opt/anaconda3/envs/qlib38/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 521, in __next__
data = self._next_data()
File "/opt/anaconda3/envs/qlib38/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 561, in _next_data
data = self._dataset_fetcher.fetch(index) # may raise StopIteration
File "/opt/anaconda3/envs/qlib38/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 46, in fetch
data = self.dataset[possibly_batched_index]
File "/opt/anaconda3/envs/qlib38/lib/python3.8/site-packages/qlib/rl/contrib/train_onpolicy.py", line 80, in __getitem__
stock_id=row["instrument"],
File "/opt/anaconda3/envs/qlib38/lib/python3.8/site-packages/pandas/core/series.py", line 1007, in __getitem__
return self._get_value(key)
File "/opt/anaconda3/envs/qlib38/lib/python3.8/site-packages/pandas/core/series.py", line 1116, in _get_value
loc = self.index.get_loc(label)
File "/opt/anaconda3/envs/qlib38/lib/python3.8/site-packages/pandas/core/indexes/base.py", line 3655, in get_loc
raise KeyError(key) from err
KeyError: 'instrument'
So how can we get this example run?
Env
- python 3.8
- qlib 0.9.7
Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requested