0

from ggplot import mtcars

While importing mtcars dataset from ggplot on jupyter notebook i got this error My system is windows 10 and I've already reinstalled and upgraded pandas (also used --user in installation command)but it didn't work out as well. Is there any other way to get rid of this error?

\Anaconda3\lib\site-packages\ggplot\stats\smoothers.py in 2 unicode_literals) 3 import numpy as np ----> 4 from pandas.lib import Timestamp 5 import pandas as pd 6 import statsmodels.api as sm

ModuleNotFoundError: No module named 'pandas.lib'

Ronak Shah
  • 377,200
  • 20
  • 156
  • 213
  • 2
    Does this answer your question? [ImportError: cannot import name 'Timestamp'](https://stackoverflow.com/questions/50591982/importerror-cannot-import-name-timestamp) – It_is_Chris Apr 22 '21 at 16:45

1 Answers1

0

I Just tried out a way. I hope this works out for others as well. I changed from this

from pandas.lib import Timestamp

to this

from pandas._libs import Timestamp

as the path of the module is saved in path C:\Users\HP\Anaconda3\Lib\site-packages\pandas-libs is _libs Also, I changed from

date_types = (
    pd.tslib.Timestamp,
    pd.DatetimeIndex,
    pd.Period,
    pd.PeriodIndex,
    datetime.datetime,
    datetime.time
)

to this

date_types = (
    pd._tslib.Timestamp,
    pd.DatetimeIndex,
    pd.Period,
    pd.PeriodIndex,
    datetime.datetime,
    datetime.time
)

Before that, I went on this path "C:\Users\HP\Anaconda3\Lib\site-packages\ggplot\util.py" to make the same changes in util.py for date_types. This helped me out to get rid of the error I mentioned in my question.