Marigold / universal-portfolios

Collection of algorithms for online portfolio selection
Other
779 stars 214 forks source link

No module named 'pandas.stats' #20

Closed xanderdunn closed 5 years ago

xanderdunn commented 5 years ago

pandas 0.24.2 universal-portfolios 0.3.3

When I attempt to from universal import algos, I get this error:

--> 117     from universal import algos

/usr/local/lib/python3.5/dist-packages/universal/algos/__init__.py in <module>
----> 1 from .crp import CRP
      2 from .bah import BAH
      3 from .anticor import Anticor
      4 from .corn import CORN
      5 from .bcrp import BCRP

/usr/local/lib/python3.5/dist-packages/universal/algos/crp.py in <module>
----> 1 from ..algo import Algo
      2 from .. import tools
      3 import numpy as np
      4 import pandas as pd
      5 import matplotlib.pyplot as plt

/usr/local/lib/python3.5/dist-packages/universal/algo.py in <module>
      6 import inspect
      7 import copy
----> 8 from .result import AlgoResult, ListResult
      9 from scipy.misc import comb
     10 from . import tools

/usr/local/lib/python3.5/dist-packages/universal/result.py in <module>
      3 import matplotlib.pyplot as plt
      4 import pickle
----> 5 from universal import tools
      6 import seaborn as sns
      7 from statsmodels.api import OLS

/usr/local/lib/python3.5/dist-packages/universal/tools.py in <module>
      3 import scipy.optimize as optimize
      4 from scipy.special import betaln
----> 5 from pandas.stats.moments import rolling_mean as rolling_m
      6 from pandas.stats.moments import rolling_corr
      7 import matplotlib.pyplot as plt

ImportError: No module named 'pandas.stats'
  In call to configurable 'train' (<function train at 0x7f03e5e6f730>)

It looks like #15 already ran into this issue. The library should be updated to latest pandas. Newer projects will be unable to revert pandas version to 0.22.

It looks like the only two instances that need to be updated are in tools.py:

from pandas.stats.moments import rolling_mean as rolling_m
from pandas.stats.moments import rolling_corr

I believe this is the replacement. Would it be df.rolling.mean() and df.rolling().corr()?

Abdoulaye-Ba commented 4 years ago

No module named 'pandas.stats' I have this problem. I need really your help to install that module

Marigold commented 4 years ago

@Abdoulaye-Ba could you post the full stackstrace? This shouldn't be the problem anymore.

gitcnd commented 3 years ago

Here is the fix:

  1. install anaconda3 - https://docs.continuum.io/anaconda/install/
  2. pip uninstall universal
  3. pip install universal-portfolios