quantopian / alphalens

Performance analysis of predictive (alpha) stock factors
http://quantopian.github.io/alphalens
Apache License 2.0
3.2k stars 1.12k forks source link

ValueError: freq must be Day, BDay or CustomBusinessDay #351

Closed holymonkey808 closed 4 years ago

holymonkey808 commented 4 years ago

Problem Description

Having the above error when providing a multiindex dataframe without setting freq. Anyway to set date freq after dataframe is created? should Performance.py line 740 and 793 be changed to use pd.infer_freq?

Please provide a minimal, self-contained, and reproducible example:

[Paste code here]

Please provide the full traceback:

[Paste traceback here]

Please provide any additional information below:

Versions

luca-s commented 4 years ago

This happened because the input dataframe was not generated by alphalens.utils.get_clean_factor_and_forward_returns, which is fine as long as you read the function documentation and makes sure your input dataframe is built in the same way as get_clean_factor_and_forward_returns does. It would also help to have a look at the function implementation, which would clarify few details.