Skip to content

plotting dtype "UInt32" fails #25587

Closed
@teto

Description

@teto

Code Sample, a copy-pastable example if possible

import pandas as pd

s = pd.Series([ 4, 5, 3 ,2 ], dtype="UInt32")
s.astype("int32").plot() # succeeds
s.plot() # fails

fails with

Traceback (most recent call last):
  File "test_plot.py", line 7, in <module>
    s.plot()
  File "/nix/store/biq309lxqwpl1nfap4h3s58wcxd134xq-python3.7-pandas-0.24.1/lib/python3.7/site-packages/pandas/plotting/_core.py", line 2740, in __call__
    **kwds)
  File "/nix/store/biq309lxqwpl1nfap4h3s58wcxd134xq-python3.7-pandas-0.24.1/lib/python3.7/site-packages/pandas/plotting/_core.py", line 1995, in plot_series
    **kwds)
  File "/nix/store/biq309lxqwpl1nfap4h3s58wcxd134xq-python3.7-pandas-0.24.1/lib/python3.7/site-packages/pandas/plotting/_core.py", line 1798, in _plot
    plot_obj.generate()
  File "/nix/store/biq309lxqwpl1nfap4h3s58wcxd134xq-python3.7-pandas-0.24.1/lib/python3.7/site-packages/pandas/plotting/_core.py", line 251, in generate
    self._make_plot()
  File "/nix/store/biq309lxqwpl1nfap4h3s58wcxd134xq-python3.7-pandas-0.24.1/lib/python3.7/site-packages/pandas/plotting/_core.py", line 993, in _make_plot
    **kwds)
  File "/nix/store/biq309lxqwpl1nfap4h3s58wcxd134xq-python3.7-pandas-0.24.1/lib/python3.7/site-packages/pandas/plotting/_core.py", line 1008, in _plot
    lines = MPLPlot._plot(ax, x, y_values, style=style, **kwds)
  File "/nix/store/biq309lxqwpl1nfap4h3s58wcxd134xq-python3.7-pandas-0.24.1/lib/python3.7/site-packages/pandas/plotting/_core.py", line 598, in _plot
    return ax.plot(*args, **kwds)
  File "/nix/store/xgfsbxa29szyi30hl48hac1gihic3z3f-python3.7-matplotlib-3.0.3/lib/python3.7/site-packages/matplotlib/__init__.py", line 1810, in inner
    return func(ax, *args, **kwargs)
  File "/nix/store/xgfsbxa29szyi30hl48hac1gihic3z3f-python3.7-matplotlib-3.0.3/lib/python3.7/site-packages/matplotlib/axes/_axes.py", line 1611, in plot
    for line in self._get_lines(*args, **kwargs):
  File "/nix/store/xgfsbxa29szyi30hl48hac1gihic3z3f-python3.7-matplotlib-3.0.3/lib/python3.7/site-packages/matplotlib/axes/_base.py", line 393, in _grab_next_args
    yield from self._plot_args(this, kwargs)
  File "/nix/store/xgfsbxa29szyi30hl48hac1gihic3z3f-python3.7-matplotlib-3.0.3/lib/python3.7/site-packages/matplotlib/axes/_base.py", line 378, in _plot_args
    ncx, ncy = x.shape[1], y.shape[1]
IndexError: tuple index out of range

Problem description

When using the new type UInt32, plotting won't work.

Output of pd.show_versions()

[paste the output of pd.show_versions() here below this line]
INSTALLED VERSIONS

commit: None
python: 3.7.2.final.0
python-bits: 64
OS: Linux
OS-release: 4.20.12
machine: x86_64
processor:
byteorder: little
LC_ALL: None
LANG: C.UTF-8
LOCALE: None.None

pandas: 0+unknown
pytest: None
pip: 19.0.3
setuptools: 40.8.0
Cython: None
numpy: 1.16.1
scipy: 1.2.1
pyarrow: None
xarray: None
IPython: None
sphinx: None
patsy: None
dateutil: 2.8.0
pytz: 2018.9
blosc: None
bottleneck: 1.2.1
tables: 3.4.4
numexpr: 2.6.9
feather: None
matplotlib: 3.0.3
openpyxl: 2.6.0
xlrd: 1.2.0
xlwt: 1.3.0
xlsxwriter: None
lxml.etree: 4.3.1
bs4: 4.7.1
html5lib: 1.0.1
sqlalchemy: 1.2.14
pymysql: None
psycopg2: None
jinja2: None
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
gcsfs: None

Metadata

Metadata

Assignees

No one assigned

    Labels

    ExtensionArrayExtending pandas with custom dtypes or arrays.Visualizationplotting

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions