quantopian / alphalens

Performance analysis of predictive (alpha) stock factors
http://quantopian.github.io/alphalens
Apache License 2.0
3.39k stars 1.15k forks source link

importing alphalens 0.3.6 gets error "No module named 'pandas.util._decorators'" #394

Open BinhKieu82 opened 2 years ago

BinhKieu82 commented 2 years ago

Problem Description

I've tried importing alphalens but encountered the issue of "No module named 'pandas.util._decorators'" right the first command of "import alphalens" Please provide a minimal, self-contained, and reproducible example:

import alphalens

Please provide the full traceback:

ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-21-6e4fa055c088> in <module>
----> 1 import alphalens

e:\temp\Python36\lib\site-packages\alphalens\__init__.py in <module>
----> 1 from . import performance
      2 from . import plotting
      3 from . import tears
      4 from . import utils
      5 

e:\temp\Python36\lib\site-packages\alphalens\performance.py in <module>
     20 from pandas.tseries.offsets import BDay
     21 from scipy import stats
---> 22 from statsmodels.regression.linear_model import OLS
     23 from statsmodels.tools.tools import add_constant
     24 from . import utils

e:\temp\Python36\lib\site-packages\statsmodels\regression\__init__.py in <module>
----> 1 from .linear_model import yule_walker
      2 
      3 from statsmodels.tools._testing import PytestTester
      4 
      5 __all__ = ['yule_walker', 'test']

e:\temp\Python36\lib\site-packages\statsmodels\regression\linear_model.py in <module>
     34 
     35 from statsmodels.compat.python import lrange, lzip
---> 36 from statsmodels.compat.pandas import Appender
     37 
     38 import numpy as np

e:\temp\Python36\lib\site-packages\statsmodels\compat\__init__.py in <module>
----> 1 from statsmodels.tools._testing import PytestTester
      2 
      3 from .python import (
      4     PY37,
      5     asunicode, asbytes, asstr,

e:\temp\Python36\lib\site-packages\statsmodels\tools\__init__.py in <module>
      1 from .tools import add_constant, categorical
----> 2 from statsmodels.tools._testing import PytestTester
      3 
      4 __all__ = ['test', 'add_constant', 'categorical']
      5 

e:\temp\Python36\lib\site-packages\statsmodels\tools\_testing.py in <module>
      9 
     10 """
---> 11 from statsmodels.compat.pandas import assert_equal
     12 
     13 import os

e:\temp\Python36\lib\site-packages\statsmodels\compat\pandas.py in <module>
      3 import numpy as np
      4 import pandas as pd
----> 5 from pandas.util._decorators import deprecate_kwarg, Appender, Substitution
      6 
      7 __all__ = ['assert_frame_equal', 'assert_index_equal', 'assert_series_equal',

ModuleNotFoundError: No module named 'pandas.util._decorators'

Please provide any additional information below: I'm using VScode Win10. I tried updating pip, pandas, np, alphalens to newer versions, still no hope. Please give me a hand on that, thanks in advance

Versions

uoftsts commented 2 years ago

Install statsmodels==0.13.2 would solve the issue