here is my data for price and factor ,i got a error of TypeError: Cannot infer number of levels from empty list ,can anyone help me ,thanks a lot
close ...
asset 000001.XSHE 000002.XSHE ... 603986.XSHG 603993.XSHG
date ...
2006-01-13 1.44 1.38 ... NaN NaN
2006-01-16 1.41 1.34 ... NaN NaN
2006-01-17 1.42 1.38 ... NaN NaN
2006-01-18 1.44 1.41 ... NaN NaN
2006-01-19 1.46 1.43 ... NaN NaN
[5 rows x 300 columns] id
date asset
2006-01-13 000001.XSHE -0.216
000002.XSHE -0.272
000063.XSHE -0.240
000069.XSHE -0.232
000100.XSHE -0.312
Please provide a minimal, self-contained, and reproducible example:
Traceback (most recent call last):
File "C:/Users/xfs9619/PycharmProjects/myprojct/Quant/alphalens_api.py", line 17, in <module>
quantiles=5,)
File "C:\Users\xfs9619\Anaconda3\lib\site-packages\alphalens\utils.py", line 794, in get_clean_factor_and_forward_returns
cumulative_returns)
File "C:\Users\xfs9619\Anaconda3\lib\site-packages\alphalens\utils.py", line 333, in compute_forward_returns
names=['date', 'asset']
File "C:\Users\xfs9619\Anaconda3\lib\site-packages\pandas\core\indexes\multi.py", line 538, in from_product
codes, levels = _factorize_from_iterables(iterables)
File "C:\Users\xfs9619\Anaconda3\lib\site-packages\pandas\core\arrays\categorical.py", line 2816, in _factorize_from_iterables
return map(list, zip(*(_factorize_from_iterable(it) for it in iterables)))
File "C:\Users\xfs9619\Anaconda3\lib\site-packages\pandas\core\arrays\categorical.py", line 2816, in <genexpr>
return map(list, zip(*(_factorize_from_iterable(it) for it in iterables)))
File "C:\Users\xfs9619\Anaconda3\lib\site-packages\pandas\core\arrays\categorical.py", line 2788, in _factorize_from_iterable
cat = Categorical(values, ordered=False)
File "C:\Users\xfs9619\Anaconda3\lib\site-packages\pandas\core\arrays\categorical.py", line 386, in __init__
codes, categories = factorize(values, sort=False)
File "C:\Users\xfs9619\Anaconda3\lib\site-packages\pandas\util\_decorators.py", line 208, in wrapper
return func(*args, **kwargs)
File "C:\Users\xfs9619\Anaconda3\lib\site-packages\pandas\core\algorithms.py", line 686, in factorize
uniques = original._shallow_copy(uniques, name=None)
File "C:\Users\xfs9619\Anaconda3\lib\site-packages\pandas\core\indexes\multi.py", line 997, in _shallow_copy
return MultiIndex.from_tuples(values, names=names, **kwargs)
File "C:\Users\xfs9619\Anaconda3\lib\site-packages\pandas\core\indexes\multi.py", line 477, in from_tuples
raise TypeError(msg)
TypeError: Cannot infer number of levels from empty list
Problem Description
here is my data for price and factor ,i got a error of TypeError: Cannot infer number of levels from empty list ,can anyone help me ,thanks a lot
asset 000001.XSHE 000002.XSHE ... 603986.XSHG 603993.XSHG date ...
2006-01-13 1.44 1.38 ... NaN NaN 2006-01-16 1.41 1.34 ... NaN NaN 2006-01-17 1.42 1.38 ... NaN NaN 2006-01-18 1.44 1.41 ... NaN NaN 2006-01-19 1.46 1.43 ... NaN NaN
[5 rows x 300 columns] id date asset
2006-01-13 000001.XSHE -0.216 000002.XSHE -0.272 000063.XSHE -0.240 000069.XSHE -0.232 000100.XSHE -0.312
Please provide a minimal, self-contained, and reproducible example:
Please provide the full traceback:
Please provide any additional information below:
Versions