Greetings from Sweden! First post!
I am relatively new to python and quantopian, so rookie-warning question here ;)
I am trying to customize a notebook template for factor analysis and I've been trying to take out pieces from the Alphalens IC tear sheet and Returns tear sheet to only plot the things I desire and by that save time by leaving out the things I do not need in these. However, I have not been successful in extracting the bars plot.
This line here:
First, without messing with the cloned notebook and just running it, I get "TypeError: ('rate_of_return() takes exactly 2 arguments (1 given)', u'occurred at index 1D')" .
Since this post is 3 years old, I can imagine things could have changed code-wise.
I've checked out https://quantopian.github.io/alphalens/alphalens.html#alphalens.utils.rate_of_return. Where the rate_of_return function takes on two arguments,
DataFrame containing returns values with column headings representing the return period.
The base period length used in the conversion It must follow pandas.Timedelta constructor format (e.g. ‘1 days’, ‘1D’, ‘30m’, ‘3h’, ‘1D1h’, etc)"
so I passed in:
al.plotting.plot_quantile_returns_bar(mean_return_by_q.apply(al.utils.rate_of_return(mean_return_by_q_daily, base_period='1D'), axis = 0)
Doing that, I get "AttributeError: 'DataFrame' object has no attribute 'name'"
So, does anyone know how one would go about extracting the barschart as it is calculated here in this notebook, with the growth rates for each time period, rather than just the means?
Any help is appreciated! :)