-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Weird IndexError for plotting after DF row selection #10891
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
Comments
The error does not change when I apply the df.loc[df.CHANNEL=='MUV'].loc['2015'].DET_TEMP.plot() |
The selection works in this form: df.loc[df.CHANNEL=='MUV', ['DET_TEMP']]['2015'].plot() |
Would it be possible to provide some reproducible example? A part of the data (or dummy data) that shows the problem? |
The error is raised by the same part as the problem fixed in #10879. But this looks to be a different problem caused by chained ops. Recommended to select by one op, such as
|
I tried to set up a dummy example, but it does not fail. :( import pandas as pd
import numpy as np
index = pd.date_range('2012', freq='3m', periods=20)
df = pd.DataFrame(np.random.rand(20,2), index=index, columns=['CASE_TEMP','DET_TEMP'])
df['CHANNEL'] = np.random.random_integers(low=1, high=2, size=20)
df.CHANNEL = df.CHANNEL.map(lambda x: 'MUV' if x==1 else 'FUV')
df.ix[4, 'DET_TEMP'] = np.NAN
df.ix[17, 'CHANNEL'] = np.NAN
df.ix[12, 'CASE_TEMP'] = np.NAN
df[df.CHANNEL=='MUV'].loc['2015'].DET_TEMP.plot() |
@sinhrks I had to put parentheses around the row selectors, before it would not choke, but then after that with my data i get the same IndexError as above: df.loc[(df.index.year == 2015) & (df.CHANNEL=='MUV'), 'DET_TEMP'].plot() @jorisvandenbossche As I wrote above, without the plot() command I don't get an error, also the describe command does not show anything weird about the data: count 18890.000000
mean -23.543606
std 0.646694
min -24.554800
25% -23.805800
50% -23.656000
75% -23.356400
max -14.368400
Name: DET_TEMP, dtype: float64 but if I store the selection into a Series, and call plot() on it it still fails. |
Looks like the link to the data 404s, and we would need a minimal example to reproduce the bug. Going to close due to needing more info but happy to reopen if we get a self-contained example. |
I'm doing this:
with the index being a DatetimeIndex and if I don't plot it all works fine:
but when I try the plotting I get this error:
System: Conda, all updates, Pandas: '0.16.2+409.g73dcb95' (73dcb95)
The text was updated successfully, but these errors were encountered: