-
Notifications
You must be signed in to change notification settings - Fork 572
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' #662
Comments
I just installed ggplot on my Windows computer running Python 3.7 using pip. When I try to run: "import pandas as pd I get the error: "AttributeError: module 'pandas' has no attribute 'tslib'" Here is the traceback: |
the same error after installation ggplot. Tried to uninstall pandas and lower version to 0.23.* - didn't help
|
Is there no fix to this issue? |
I assume we can change |
in the ggplot/utils.py file change
to
Then do the same in the ggplot/stats/smoothers.py file
I haven't tested out the code yet to see if anything doesnt work, but it imported at least |
Thanks @Aycrazy it also allowed me to import. Slight typo on your fix
|
yes. Thanks. Should have proofread |
Hi guys, from ggplot import * NameError Traceback (most recent call last) ~/.local/lib/python3.6/site-packages/IPython/lib/pretty.py in pretty(self, obj) ~/.local/lib/python3.6/site-packages/IPython/lib/pretty.py in repr_pprint(obj, p, cycle) ~/anaconda/envs/tf12/lib/python3.6/site-packages/ggplot/ggplot.py in repr(self) ~/anaconda/envs/tf12/lib/python3.6/site-packages/ggplot/ggplot.py in make(self) ~/anaconda/envs/tf12/lib/python3.6/site-packages/ggplot/stats/stat_smooth.py in plot(self, ax, data, _aes) ~/anaconda/envs/tf12/lib/python3.6/site-packages/ggplot/stats/smoothers.py in lm(x, y, alpha) ~/anaconda/envs/tf12/lib/python3.6/site-packages/ggplot/stats/smoothers.py in (.0) NameError: name 'Timestamp' is not defined |
No comment on your specific issue but I was able to use it for some things but not for everything e.g. I can create scatter plots but not bar charts as per #152 |
There are two separate but similar problems. Both are in smoothers.py, the first is in line 4 'from pandas.lib import Timestamp' why this line isn't failing with pandas 0.24.2 s beyond me but it does mean the later attempts to use the imported function don't work. A possible correction to this is to remove the '.lib' from this line. I will clone, experiment, and get back. Given this import, the main installation problem identified by the OP should be fixed by changing line 14 'pd.tslib.Timestamp,' can be changed to 'Tiimestamp' again I'll clone, experiment, and get back. ETA: it has certainly solved the installation problem against pandas v 0.24.2, will experiment with using smoothers and get back. |
And as far as I can tell those changes do the trick. For backward compatibility, it would be nice to know which version of pandas the reorganisation happened in so code can be written to cope with both situations. Oh and just remembered there is a similar problem with utils.py a line 81. Also changed in my local version. |
AttributeError: module 'pandas' has no attribute 'tslib' |
Just sent through a PR to fix this problem: #664 |
for temporary fix downgrade pandas to 0.19.2 |
I did worked for me but had to do some chnages in utils file int stats/smoothers.py file instead of it should work fine |
Works like magic! Thanks dude. 👍 |
That should not work fine. The correct way should be:
|
^ This works beautifully. |
Can we merge this: #664 ? Seems like the simple import fix is the consensus solution? |
Fresh python 3.7.6 install and this fails. Second merging #664 |
Issue still there... Python 3.8 0^0 |
The package ggplot has not been updated since 2016. |
You're terrific! |
Any fix for this? Still an issue with pandas==1.0.4 and python 3.7 |
You can self fix your local package after installation with the instruction from I follow their guide, it worked for this issue but would face another issue #612 Finally, if your OS is Linux and you use Miniconda or Anaconda to manage your environment, you can run these commands to make it work. Fix AttributeError: module 'pandas' has no attribute 'tslib'AttributeError: module 'pandas' has no attribute 'tslib' when importing ggplot (#662)
Fix AttributeError: 'DataFrame' object has no attribute 'sort' (#612)
Simple workaroundIn case it is not really necessary to use pandas==1.0.4, simply downgrading the pandas version with: |
As others have said, the package hasn't been updated since 2016. Use plotnine instead:
|
Thanks for suggestions how to fix, but yeah these workarounds don't really work for places where you share server environments as its very messy. Wondering why master hasn't been updated since 2016, anyone know? |
Try the following solution instead of odo....... https://tereshenkov.wordpress.com/2018/02/08/adding-ipython-sql-magic-to-jupyter-notebook/ |
https://tereshenkov.wordpress.com/2018/02/08/adding-ipython-sql-magic-to-jupyter-notebook/ |
Works perfect. Thanks |
Might it can be helpful for you as well ❤️ just assume that your and then
|
Solution : This solution worked for me, goto ggplot/utils.py date_types = ( to date_types = ( Then goto to ggplot/stats/smoothers.py this to and again change this date_types = ( to date_types = ( in smoothers.py |
Perhaps related #676 |
Solution Install
|
import pandas as pd |
No description provided.
The text was updated successfully, but these errors were encountered: