Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

pyplot.plot using pandas series raises DeprecationWarning with pandas=1.0.0rc0 #16295

Copy link
Copy link
@MaozGelbart

Description

@MaozGelbart
Issue body actions

Bug report

Bug summary

The code below raises DeprecationWarning from pandas=1.0.0rc0 when plt.plot is fed with two pandas.Series (using my matplotlib=3.1.0 instance). It reproduces also when the series is not empty, and also when plotting two different series as x and y.

Code for reproduction

import pandas as pd
import matplotlib.pyplot as plt

x = pd.Series([], dtype="float64")
plt.plot(x, x)

Actual outcome

Traceback (most recent call last):
  File "pandas1.py", line 5, in <module>
    plt.plot(x, x)
  File "/lib/python3.7/site-packages/matplotlib/pyplot.py", line 2789, in plot
    is not None else {}), **kwargs)
  File "/lib/python3.7/site-packages/matplotlib/axes/_axes.py", line 1666, in plot
    lines = [*self._get_lines(*args, data=data, **kwargs)]
  File "/lib/python3.7/site-packages/matplotlib/axes/_base.py", line 225, in __call__
    yield from self._plot_args(this, kwargs)
  File "/lib/python3.7/site-packages/matplotlib/axes/_base.py", line 386, in _plot_args
    x = _check_1d(tup[0])
  File "/lib/python3.7/site-packages/matplotlib/cbook/__init__.py", line 1402, in _check_1d
    x[:, None]
  File "/lib/python3.7/site-packages/pandas/core/series.py", line 865, in __getitem__
    return self._get_with(key)
  File "/lib/python3.7/site-packages/pandas/core/series.py", line 878, in _get_with
    return self._get_values_tuple(key)
  File "/lib/python3.7/site-packages/pandas/core/series.py", line 920, in _get_values_tuple
    return self._get_values(key)
  File "/lib/python3.7/site-packages/pandas/core/series.py", line 934, in _get_values
    self._data.get_slice(indexer), fastpath=True
  File "/lib/python3.7/site-packages/pandas/core/internals/managers.py", line 1542, in get_slice
    return type(self)(self._block._slice(slobj), self.index[slobj], fastpath=True)
  File "/lib/python3.7/site-packages/pandas/core/indexes/range.py", line 708, in __getitem__
    return super().__getitem__(key)
  File "/lib/python3.7/site-packages/pandas/core/indexes/base.py", line 3908, in __getitem__
    deprecate_ndim_indexing(result)
  File "/lib/python3.7/site-packages/pandas/core/indexes/base.py", line 5553, in deprecate_ndim_indexing
    stacklevel=3,
DeprecationWarning: Support for multi-dimensional indexing (e.g. `index[:, None]`) on an Index is deprecated and will be removed in a future version.  Convert to a numpy array before indexing instead.

Expected outcome

No warnings.

Matplotlib version

  • Operating system: linux
  • Matplotlib version: 3.1.0
  • Matplotlib backend (print(matplotlib.get_backend())): agg
  • Python version: 3.7.3
  • Other libraries: pandas=1.0.0rc0

python and matplotlib obtained through anaconda, pandas through pip

Metadata

Metadata

Assignees

No one assigned

    Labels

    Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.