Course Name: Financial Time Series Analysis for Trading, Section No: 26, Unit No: 6, Unit type: Notebook
Hi,
in In20:
pf.create_simple_tear_sheet(merged_df.resample('1D').sum()['strategy_returns'])
the system says:
undefined name 'pf' (pyflakes E)
how can I solve it?
Thanks
Hi David,
The error undefined name 'pf' suggests that you are using 'pf' in your code, but you have not defined it or imported it from another module.
To fix this error, you can either define the variable pf at the beginning of your code as shown in the following line:
import pyfolio as pf
I also wish to inform you that we are currently in the process of updating this notebook as we have discovered a few issues with the same. And we shall keep you posted once it is fixed.
Until then, I hope this helps.
Thanks for the info
I have tried to install pyfolio but the rror persists. Furthermore, pyfolio library is giving me problems with sypder…
something suggestion to solve it?
Thanks in advance
Hi David,
It seems that support for pyfolio has been on the decline. In response, the library "pyfolio-reloaded" was created with the same functionality. You can install pyfolio-reloaded by using the following commands:
pip install pyfolio-reloaded
You can check the GitHub page here.
Note that the GitHub page says that the pyfolio and pyfolio-reloaded library are typically used in jupyter notebooks. So your issue might still persist in spyder.
I feel that pyflakes error is something which is specific to the "pyflakes" library and not related to pyfolio. Does the code run even with the error?