Pyfolio - AttributeError: 'numpy.int64' object has no attribute 'to_pydatetime'

Viewed 2037

I am new to python and I'm having some problems. I searched some previously asked similar questions. I read through the answers and some solutions, but I am still unable to solve to problem.

Any guidance for this issue ?

import FinanceDataReader as fdr
import pyfolio as pf
import numpy as np
from datetime import datetime, timedelta

df = fdr.DataReader('AAPL')
return_series = df['Close'].pct_change().fillna(0)

pf.create_full_tear_sheet(return_series)
AttributeError: 'numpy.int64' object has no attribute 'to_pydatetime'
1 Answers

There are some open issues about it in pyfolio's GitHub repository. Apparently, they fixed this issue in their repository, but it's not up-to-date in the Python Package Index (pip).

I tried a suggestion from this second issue, and it solved for me:

# remove your installed pyfolio library
pip uninstall pyfolio

# Install it again from its github repo
pip install git+https://github.com/quantopian/pyfolio
Related