stefan-jansen / pyfolio-reloaded

Portfolio and risk analytics in Python
https://pyfolio.ml4trading.io/
Apache License 2.0
348 stars 109 forks source link

Cannot import pyfolio-reloaded #23

Closed SignoriC closed 1 year ago

SignoriC commented 1 year ago

When trying to import pyfolio I'm sent this message:

TypeError: int() argument must be a string, a bytes-like object or a number, not 'NaTType'

I'm trying to use pyfolio in Jupiter Notebook in Anaconda Navigator.

Please provide a minimal, self-contained, and reproducible example:

# Importo pyfolio
import pyfolio as pf

Please provide the full traceback:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_11760/2243473067.py in <module>
      1 # Importo pyfolio
----> 2 import pyfolio as pf

~\anaconda3\lib\site-packages\pyfolio\__init__.py in <module>
----> 1 from . import utils
      2 from . import timeseries
      3 from . import pos
      4 from . import txn
      5 from . import interesting_periods

~\anaconda3\lib\site-packages\pyfolio\utils.py in <module>
     24 import empyrical.utils
     25 
---> 26 from . import pos
     27 from . import txn
     28 

~\anaconda3\lib\site-packages\pyfolio\pos.py in <module>
     18 
     19 try:
---> 20     from zipline.assets import Equity, Future
     21 
     22     ZIPLINE = True

~\anaconda3\lib\site-packages\zipline\__init__.py in <module>
     19 # This is *not* a place to dump arbitrary classes/modules for convenience,
     20 # it is a place to expose the public interfaces.
---> 21 from trading_calendars import get_calendar
     22 
     23 from . import data

~\anaconda3\lib\site-packages\trading_calendars\__init__.py in <module>
     14 # limitations under the License.
     15 
---> 16 from .trading_calendar import TradingCalendar
     17 from .calendar_utils import (
     18     clear_calendars,

~\anaconda3\lib\site-packages\trading_calendars\trading_calendar.py in <module>
     31 import toolz
     32 
---> 33 from .calendar_helpers import (
     34     NP_NAT,
     35     compute_all_minutes,

~\anaconda3\lib\site-packages\trading_calendars\calendar_helpers.py in <module>
      4 NANOSECONDS_PER_MINUTE = int(6e10)
      5 
----> 6 NP_NAT = np.array([pd.NaT], dtype=np.int64)[0]
      7 
      8 

TypeError: int() argument must be a string, a bytes-like object or a number, not 'NaTType'

Please provide any additional information below:

Versions

stefan-jansen commented 1 year ago

We've just updated to Pyfolio 0.9.5. Please try with the current version; if you install Zipline, please use the new 2.4.0b1.

stefan-jansen commented 1 year ago

Closing for now; feel free to reopen should this issue persist.

SignoriC commented 1 year ago

Thanks a lot. Now it works.