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

datetime conflict with matplotlib #3121

Closed
ocehugo opened this issue Jul 20, 2016 · 2 comments
Closed

datetime conflict with matplotlib #3121

ocehugo opened this issue Jul 20, 2016 · 2 comments

Comments

@ocehugo
Copy link

ocehugo commented Jul 20, 2016

Hi, just reposting this from the matplotlib issue 6796.

[ 1.5.1 , 3.5, OSX] Matplotlib version, Python version and Platform (Windows, OSX, Linux ...)
[ pip ] How did you install Matplotlib and Python (pip, anaconda, from source ...)
[0.6.1] statsmodels

The issue is that the import of statsmodels break compatibility with standard matplotlib plotting, since statsmodels overwrite the datetime namespace (or Pandas). This cause the following bug when using the Pandas datetime.

TypeError: float() argument must be a string or a number, not 'datetime.date'

How to reproduce:

import datetime
import matplotlib.pyplot as plt
import statsmodels.api as sm

#this works
x = [datetime.date(1678,1,1) + datetime.timedelta(days=i) for i in range(10)]
plt.plot(x,range(10))
#this do not
x = [datetime.date(1677,1,1) + datetime.timedelta(days=i) for i in range(10)]
plt.plot(x,range(10))

without the statsmodels.api as sm both lines works.

I would expect that just importing a function from the package would not override the defaults ones.

@ocehugo
Copy link
Author

ocehugo commented Jul 20, 2016

Hi just realize that this should be at pandas.
You can close this.

@josef-pkt
Copy link
Member

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

No branches or pull requests

2 participants