I'm trying to run Pyfolio's pf.create_full_tear_sheet(df_returns) function on my own set of returns data df_returns (pandas dataframe) which looks like this:
However I'm getting the error:
TypeError: Addition/subtraction of integers and integer-arrays with DatetimeArray is no longer supported. Instead of adding/subtracting `n`, use `n * obj.freq`
I suspect the date format might be the problem, hence I checked the datatype:
In: df_returns['Date'].dtype
Out: dtype('<M8[ns]')
In: df_returns['% Returns'].dtype
Out: dtype('float64')
Could it be that I'm not specifying the benchmark data in pf.create_full_tear_sheet(df_returns) that's causing the error too?

I can't really reproduce your error. It might have to do with the fact that you are passing a full dataframe: according to Pyfolio's API reference the
returnsargument has to be passed as apd.Series.If I pass just the
Returns %column it gives proper output. Try:It is good to note that I found the package dependencies to be quite outdated:
ziplinewhich degradespandasback to0.22.0.matplotlibis throwing a lot of deprecated warnings since3.2.xso I degraded it to3.1.x..argmin()is deprecated and throws warnings. This issue has been known since 2019-05-24.This leads me to believe
pyfoliocan be very sensitive to your environment. Did you install it using the virtual environment instructions in the docs?