6

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 Answer 1

11

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
Sign up to request clarification or add additional context in comments.

1 Comment

Nice job. That one worked for me. A lot of other solutions involves bruteforce changes of the library inner code, which I think is very intrusive and is more probable to lead to bugs and collateral effects.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.