Skip to content

Weird IndexError for plotting after DF row selection #10891

Closed
@michaelaye

Description

@michaelaye

I'm doing this:

df[df.CHANNEL=='MUV'].loc['2015'].DET_TEMP.plot()

with the index being a DatetimeIndex and if I don't plot it all works fine:

df[df.CHANNEL=='MUV'].loc['2015'][['CHANNEL','DET_TEMP']].head()

screenshot 2015-08-22 23 47 18

but when I try the plotting I get this error:

---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-84-28500c6c30a0> in <module>()
----> 1 df[df.CHANNEL=='MUV'].loc['2015'].DET_TEMP.plot()

/usr/local/python3/miniconda/lib/python3.4/site-packages/pandas-0.16.2+409.g73dcb95-py3.4-linux-x86_64.egg/pandas/tools/plotting.py in plot_series(data, kind, ax, figsize, use_index, title, grid, legend, style, logx, logy, loglog, xticks, yticks, xlim, ylim, rot, fontsize, colormap, table, yerr, xerr, label, secondary_y, **kwds)
   2526                  yerr=yerr, xerr=xerr,
   2527                  label=label, secondary_y=secondary_y,
-> 2528                  **kwds)
   2529 
   2530 

/usr/local/python3/miniconda/lib/python3.4/site-packages/pandas-0.16.2+409.g73dcb95-py3.4-linux-x86_64.egg/pandas/tools/plotting.py in _plot(data, x, y, subplots, ax, kind, **kwds)
   2331         plot_obj = klass(data, subplots=subplots, ax=ax, kind=kind, **kwds)
   2332 
-> 2333     plot_obj.generate()
   2334     plot_obj.draw()
   2335     return plot_obj.result

/usr/local/python3/miniconda/lib/python3.4/site-packages/pandas-0.16.2+409.g73dcb95-py3.4-linux-x86_64.egg/pandas/tools/plotting.py in generate(self)
    940         self._make_legend()
    941         self._post_plot_logic()
--> 942         self._adorn_subplots()
    943 
    944     def _args_adjust(self):

/usr/local/python3/miniconda/lib/python3.4/site-packages/pandas-0.16.2+409.g73dcb95-py3.4-linux-x86_64.egg/pandas/tools/plotting.py in _adorn_subplots(self)
   1068                                 naxes=nrows * ncols, nrows=nrows,
   1069                                 ncols=ncols, sharex=self.sharex,
-> 1070                                 sharey=self.sharey)
   1071 
   1072         for ax in to_adorn:

/usr/local/python3/miniconda/lib/python3.4/site-packages/pandas-0.16.2+409.g73dcb95-py3.4-linux-x86_64.egg/pandas/tools/plotting.py in _handle_shared_axes(axarr, nplots, naxes, nrows, ncols, sharex, sharey)
   3333         layout = np.zeros((nrows+1,ncols+1), dtype=np.bool)
   3334         for ax in axarr:
-> 3335             layout[ax.rowNum, ax.colNum] = ax.get_visible()
   3336 
   3337         if sharex and nrows > 1:

IndexError: index 5 is out of bounds for axis 1 with size 3

System: Conda, all updates, Pandas: '0.16.2+409.g73dcb95' (73dcb95)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions