yhat / ggpy

ggplot port for python
http://yhat.github.io/ggpy/
BSD 2-Clause "Simplified" License
3.69k stars 573 forks source link

change to imports for pandas Timestamp module #643

Open panzerstadt opened 6 years ago

panzerstadt commented 6 years ago

pandas 0.23.0 ggplot 0.11.5

changed from pandas.lib import Timestamp to from pandas import Timestamp, might break compability with old pandas.

an alternative may be to do a try except....? which might look pretty bad, but I haven't really researched into how to support multiple pandas versions with different import endpoints.

reference: https://stackoverflow.com/questions/50591982/importerror-cannot-import-name-timestamp

lukesmurray commented 6 years ago

Anyway this could be merged @glamp?

ghost commented 6 years ago

smoothers.py:4: FutureWarning: The pandas.lib module is deprecated and will be removed in a future version. These are private functions and can be accessed from pandas._libs.lib instead

The deprecation message is not great advice, the public interface is pandas.Timstamp so this PR is doing the right thing. I don't think there's anything wrong with doing a try / catch for library imports but in this case I don't see it breaking backwards compatibility. I can see pandas.Timestamp mentioned back in v0.13 which is very old indeed http://pandas.pydata.org/pandas-docs/version/0.13/10min.html?highlight=timestamp

I've tested it against 0.19.0 as well and the import works fine as per this patch

>>> import pandas as pd
>>> pd.__version__
u'0.19.0'
>>> from pandas import Timestamp
>>>

Note, there's a second deprecation message that comes from running gglplot's smoothers.py:

FutureWarning: pandas.tslib is deprecated and will be removed in a future version.

This is from line 14. It hasn't been removed from Pandas yet but will cause a similar issue that this PR addresses.

Ozeidi commented 5 years ago

Please merge this to align with recent panda changes.

whyboris commented 5 years ago

Please merge this -- I am unable to use ggplot without manually having to edit the installed module 😢

sushinoya commented 5 years ago

Can we please merge this?