Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: module 'pandas' has no attribute 'tslib' #27385

Closed
syoux opened this issue Jul 14, 2019 · 4 comments
Closed

AttributeError: module 'pandas' has no attribute 'tslib' #27385

syoux opened this issue Jul 14, 2019 · 4 comments

Comments

@syoux
Copy link

syoux commented Jul 14, 2019

Problem description

I just installed ggplot on my Windows x64 running Python 3.5 using pip. When I try to run:

from ggplot import *
from sklearn.metrics import roc_curve, auc

preds = log_mod.predict_proba(X_test)[:,1]
fpr, tpr, _ = roc_curve(y_test, preds)

df_dummies = pd.DataFrame(dict(fpr=fpr, tpr=tpr))
ggplot(df_dummies, aes(x='fpr', y='tpr')) +
geom_line() +
geom_abline(linetype='dashed')

I got the error: AttributeError: module 'pandas' has no attribute 'tslib'

Here is the traceback:
AttributeError Traceback (most recent call last)
in
----> 1 from ggplot import *
2 from sklearn.metrics import roc_curve, auc
3
4
5 preds = log_mod.predict_proba(X_test)[:,1]

~\Anaconda3\lib\site-packages\ggplot_init_.py in
17
18
---> 19 from .geoms import geom_area, geom_blank, geom_boxplot, geom_line, geom_point, geom_jitter, geom_histogram, geom_density, geom_hline, geom_vline, geom_bar, geom_abline, geom_tile, geom_rect, geom_bin2d, geom_step, geom_text, geom_path, geom_ribbon, geom_now_its_art, geom_violin, geom_errorbar, geom_polygon
20 from .stats import stat_smooth, stat_density
21

~\Anaconda3\lib\site-packages\ggplot\geoms_init_.py in
----> 1 from .geom_abline import geom_abline
2 from .geom_area import geom_area
3 from .geom_bar import geom_bar
4 from .geom_bin2d import geom_bin2d
5 from .geom_blank import geom_blank

~\Anaconda3\lib\site-packages\ggplot\geoms\geom_abline.py in
----> 1 from .geom import geom
2
3 class geom_abline(geom):
4 """
5 Line specified by slope and intercept

~\Anaconda3\lib\site-packages\ggplot\geoms\geom.py in
1 from future import (absolute_import, division, print_function,
2 unicode_literals)
----> 3 from ..ggplot import ggplot
4 from ..aes import aes
5

~\Anaconda3\lib\site-packages\ggplot\ggplot.py in
11 import warnings
12
---> 13 from .aes import aes
14 from .legend import make_legend
15 from .themes import theme_gray

~\Anaconda3\lib\site-packages\ggplot\aes.py in
9 from patsy.eval import EvalEnvironment
10
---> 11 from . import utils
12
13 import numpy as np

~\Anaconda3\lib\site-packages\ggplot\utils.py in
79
80 date_types = (
---> 81 pd.tslib.Timestamp,
82 pd.DatetimeIndex,
83 pd.Period,

AttributeError: module 'pandas' has no attribute 'tslib'

I have tried to :

change

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

date_types = (
pd.Timestamp,
pd.DatetimeIndex,
pd.Period,
pd.PeriodIndex,
datetime.datetime,
datetime.time
)
Then do the same in the ggplot/stats/smoothers.py file
AND
comment out

from pandas.lib import Timestamp

But It didn't work.

Expected Output

Output of pd.show_versions()

[paste the output of pd.show_versions() here below this line]

@jbrockmendel
Copy link
Member

pd.Timestamp should work fine. pd.tslib has been gone for a while

@WillAyd
Copy link
Member

WillAyd commented Jul 14, 2019

From the traceback it looks like this is an issue with ggplot and it has already been brought up on their tracker:

yhat/ggpy#662

It doesn't really look like that package is maintained though so I think we should repurpose this issue to remove any reference to ggplot from our docs. I see only one:

https://pandas.pydata.org/pandas-docs/stable/user_guide/visualization.html?highlight=ggplot#setting-the-plot-style

@WillAyd WillAyd changed the title AttributeError: module 'pandas' has no attribute 'tslib' Remove ggplot references from docs Jul 14, 2019
@WillAyd WillAyd changed the title Remove ggplot references from docs AttributeError: module 'pandas' has no attribute 'tslib' Jul 14, 2019
@WillAyd
Copy link
Member

WillAyd commented Jul 14, 2019

Ignore previous comment - shouldn't need to change docs as ggplot is a built in style for matplotlib. @syouhung1904 your issue seems to stem from that third party library so nothing to be done on the pandas side here.

@JHLi22
Copy link

JHLi22 commented Aug 26, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants