使用features,报错ERROR - qlib.workflow - [utils.py:41] - An exception has been raised[UnicodeEncodeError: 'ascii' codec can't encode characters in position 18-20: ordinal not in range(128)]
❓ 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. ERROR - qlib.workflow - [utils.py:41] - An exception has been raised[UnicodeEncodeError: 'ascii' codec can't encode characters in position 18-20: ordinal not in range(128)]
Hi, @Liumh-01 How can we reproduce your issue?
@SunsetWolf Thanks for your reply import qlib from qlib.data import D qlib.init(provider_uri = "data/qlib_demo_data") all_code = D.list_instruments(D.instruments("all"),as_list=True) returns = D.features(instruments=all_code,fields=["$close/Ref($close,1)-1"],start_time='2023-02-01',end_time='2024-09-13',freq='day') print(returns) when instruments = one specific stock code,there is no problem,when i want to let instruments = more than one stock code,it will report errors:ERROR - qlib.workflow - [utils.py:41] - An exception has been raised[UnicodeEncodeError: 'ascii' codec can't encode characters in position 18-20: ordinal not in range(128)]
Hi, @Liumh-01
We now understand your code, and it looks good. We would like to know what the data pointed to by the path data/qlib_demo_data in your code looks like.
@SunsetWolf ,Hi, the path is created from following way: import qlib from qlib.tests.data import GetData data_uri = 'data/qlib_demo_data' qlib.init(provider_uri=data_uri, region="cn") GetData().qlib_data(target_dir=data_uri, region='cn') so,the data/qlib_demo_data is satisfied with the format that qlib required
Hi, @Liumh-01 , I didn't reproduce your problem, today I tried to run your code using a docker image and it is fine, you can try to pull and run the image and then run your code following the steps in the README.
same problem, error occurred on win11
same problem, error occurred on win11
@Liumh-01 I think it's because of joblib cannot parse chinese char of temp dir, you can manually change temp dir to normal path