Skip to content

ImportError: cannot import name _get_all_lines, when trying to plot a grouped DF #7876

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

Closed
lJoublanc opened this issue Jul 30, 2014 · 4 comments

Comments

@lJoublanc
Copy link

I have a DataFrame of stock close prices with a DatetimeIndex , close.


                     BARC:LON  HSBA:LON  LLOY:LON  STAN:LON
timestamp                                                  
2014-07-03 08:02:00   217.551   601.938   76.2100   1223.36
2014-07-03 08:04:00   217.200   602.100   75.8520   1220.00
2014-07-03 08:06:00   217.500   602.700   75.8700   1221.50
2014-07-03 08:08:00   217.750   602.400   75.9777   1222.50
2014-07-03 08:10:00   218.450   602.675   75.9440   1221.50

I want to plot these in separate graphs for each day, so I do:

for day,data in  close.groupby(close.index.date):
  data.plot(title=day)
  show()

But this throws

C:\Users\xxx\local\Enthought\Canopy\User\lib\site-packages\pandas\tseries\plotting.py in <module>()
     19                                       TimeSeries_DateFormatter)
     20 
---> 21 from pandas.tools.plotting import _get_all_lines, _get_xlim
     22 
     23 #----------------------------------------------------------------------

ImportError: cannot import name _get_all_lines

I can't find _get_all_lines anywhere. I recall doing this on my linux machine and it worked fine. This is running on Windows, pandas 0.14.1.
Also this works if I call matplotlib directly using plot(data), so the code doesn't seem to be at fault.

@sinhrks
Copy link
Member

sinhrks commented Jul 30, 2014

Are you using the latest master? _get_all_lines does exist (and tsplot no longer import it after #7717 because of refactoring).
https://github.com/pydata/pandas/blob/master/pandas/tools/plotting.py#L3024

May be an installation issue, otherwise the problem should always occur when importing tsplot.

@lJoublanc
Copy link
Author

No, this is 0.14.1-1. It's from the Enthought distro, so it may just be they've packaged it incorrectly. Maybe I'll contact them. But the issue you're linking to is due to be released in 0.15, so it shouldn't affect 0.14, right?

@lJoublanc
Copy link
Author

Ok, closing this issue as it seems to be a problem with the installation. Just restarted python and it works fine. Go figure!

@sinhrks
Copy link
Member

sinhrks commented Jul 30, 2014

Thanks to confirm. Yes, #7717 will not affect to v0.14.1 (I've assumed you're using dev version).

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

2 participants