Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
  • Apr 12 17:50
    estavillo97 commented #654
  • Apr 05 12:07
    gerileka commented #682
  • Apr 05 12:05
    gerileka commented #682
  • Mar 15 02:22
    yitelee commented #655
  • Feb 25 05:12
    jjphung commented #655
  • Feb 25 05:12
    jjphung commented #655
  • Feb 24 03:12
    bommarito18 commented #655
  • Feb 16 17:07
    Waterkin opened #688
  • Feb 15 09:30
    ngloom commented #652
  • Dec 26 2021 17:08
    HidenobuTokuda opened #687
  • Dec 02 2021 05:21
    changjulian17 commented #652
  • Nov 29 2021 20:00
    SirPinewood edited #686
  • Nov 29 2021 19:58
    SirPinewood opened #686
  • Nov 14 2021 01:06
    neoking89 commented #485
  • Oct 17 2021 17:50
    Sergey80 closed #684
  • Oct 17 2021 17:50
    Sergey80 commented #684
  • Oct 10 2021 23:10
    Rajmehta123 opened #685
  • Oct 10 2021 16:52
    Sergey80 edited #684
  • Oct 10 2021 16:51
    Sergey80 edited #684
  • Oct 10 2021 16:50
    Sergey80 edited #684
George Ho
if you pass in return_fig=True, it will give you the matplotlib figure
hope I understood your question correctly
hello guys,
im trying to run pyfolio on results form zipline
when i try running
returns, positions, transactions, gross_lev = pf.utils.extract_rets_pos_txn_from_zipline(results)
i get an error
AttributeError: 'RangeIndex' object has no attribute 'normalize'
any ideas?
and wouldn't pyfolio work on python 2.7?
George Ho
Hi @IA-UoK, could you please post a full stack trace?
pyfolio and zipline are experiencing some compatibility issues right now, which we're trying to fix. However, this problem doesn't sound like its happening because of that

@georgh0021 here you go...

AttributeError Traceback (most recent call last)

<ipython-input-7-dbdebde5f2a4> in <module>()
----> 1 returns, positions, transactions, gross_lev = pf.utils.extract_rets_pos_txn_from_zipline(results)

/Users/im572/anaconda/envs/zl36/lib/python3.6/site-packages/pyfolio/utils.py in extract_rets_pos_txn_from_zipline(backtest)
427 """
--> 429 backtest.index = backtest.index.normalize()
430 if backtest.index.tzinfo is None:
431 backtest.index = backtest.index.tz_localize('UTC')

AttributeError: 'RangeIndex' object has no attribute 'normalize'

i have tried it on both python 2.7 and 3.6
same results
George Ho
hi @IA-UoK, are you using the latest version of pyfolio? Could you also open a github issue and describe how you're using zipline and pyfolio? I can't seem to recreate the bug you have
hi there! i'm a total beginner and am looking for a portfolio analysis tool and was wondering if pyfolio is right for me. I have a portfolio of various sp500 equities and I would love to see analysis on the entire portfolio as a whole (e.g. have 2 shares FB, 6 shares GOOG, 3 shares IBM, etc.). Would pyfolio be able to help me do this?
Arash Gol-Mohammadi

I guess there is a problem in tears.py (pyfolio 0.9), line 641.

change (bootstrap is not None) to (bootstrap is not False) saved my life :)

Tim Paine
@twiecki et al, noticed some name squatting on cufflinks and it led us to quantopian/empyrical#105 and quantopian/pyfolio#576, we contacted pypa to get the cufflinks3 clone removed/transferred as it could be a security risk in the future, I recommend doing the same for these two
Tim Paine
I've been trying to generate a create_returns_tear_sheet and am running into 'truth value of a Series is ambiguous' errors on a single security - is this a known issue? Can't seem to find anything on the github page...
@nyc-tinker Figured it out: looks like returns parameter I used was a dataframe object instead of a pandas series...
I have an error when using some functions in pyfolio: pyfolio.timeseries.get_top_drawdowns(returns, top=10)
AttributeError: 'DataFrame' object has no attribute 'argmin'
ValueError: Must pass 2-d input
Schermata 2019-02-01 alle 13.08.42.png
There are returns i'm using
Do ypu know why i'm having this error?
i installed the pyfolio package and the rest of packages with python, however how do i use them?
@peanutice https://www.youtube.com/watch?v=BCLgXjxYONg seems like good intro
Prabu Natarajan
can someone help me with this error, when i run the function pf.create_returns_tear_sheet(returns) ...
std = var.dtype.type(np.sqrt(var))
AttributeError: 'float' object has no attribute 'dtype'
Prabu Natarajan
got it, my returns column was object instead of float
Hi all!, is this tool a blackbox where one runs a command and gets output or is there actual documentation to modify the code? I'd appreciate some feedback; thanks!
Hi everyone, is there any way to use Pyfolio from outside of notebook. I am running my Algo from PyCharm or command line and would like to see the tear sheet either as pdf or pop up on screen. Thanks!
Fabio Federici
hi all, any information of what the default risk-free rate is when creating a tear sheet?
Caio Lacerda de Castro
Hello guys! First time here. Does pyfolio works well with python 3.8 or should I open a separate python environment with a different version?
Juergen Jean-Marie
Where can I find an example for pyfolio for pure python?
yun jinqi
this function returns the valley as a number,the target is a datetime
so np.argmin is right?
yun jinqi
ok,solve it . we should add a code to the last
valley = list(underwater.index)[valley]
change number to datetime
Hi everyone , since the platform was shutdown, taking all instructions away. May I ask, can I still import Quantopian locally? If yes, could you please point me the reference ? Thanks
Juergen Jean-Marie
Can I use this for forex?
Hi guys! a few questions: 1. do the returns need to include weekends for the tearsheet to work? I get different result, but want to standardize it for both stocks and crypto
  1. in jupyter notebook it works perfect, but I would also like to make it work with the fantastic plots from the tearsheet in vs code. any ideas?
Louis De Bontin
Hello, I'm trying to run the exemples on a jupyterlab, but I have errors from the start :
UserWarning: Module "zipline.assets" not found; mutltipliers will not be applied to position notionals.