Skip to content
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

plotting dtype "UInt32" fails #25587

teto opened this issue Mar 7, 2019 · 4 comments


Copy link

commented Mar 7, 2019

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 "", line 7, in <module>
  File "/nix/store/biq309lxqwpl1nfap4h3s58wcxd134xq-python3.7-pandas-0.24.1/lib/python3.7/site-packages/pandas/plotting/", line 2740, in __call__
  File "/nix/store/biq309lxqwpl1nfap4h3s58wcxd134xq-python3.7-pandas-0.24.1/lib/python3.7/site-packages/pandas/plotting/", line 1995, in plot_series
  File "/nix/store/biq309lxqwpl1nfap4h3s58wcxd134xq-python3.7-pandas-0.24.1/lib/python3.7/site-packages/pandas/plotting/", line 1798, in _plot
  File "/nix/store/biq309lxqwpl1nfap4h3s58wcxd134xq-python3.7-pandas-0.24.1/lib/python3.7/site-packages/pandas/plotting/", line 251, in generate
  File "/nix/store/biq309lxqwpl1nfap4h3s58wcxd134xq-python3.7-pandas-0.24.1/lib/python3.7/site-packages/pandas/plotting/", line 993, in _make_plot
  File "/nix/store/biq309lxqwpl1nfap4h3s58wcxd134xq-python3.7-pandas-0.24.1/lib/python3.7/site-packages/pandas/plotting/", 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/", 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/", 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/", 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/", 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/", 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]

commit: None
python-bits: 64
OS: Linux
OS-release: 4.20.12
machine: x86_64
byteorder: little
LC_ALL: None
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


This comment has been minimized.

Copy link

commented Mar 7, 2019

pandas: 0+unknown, why is this?


This comment has been minimized.

Copy link

commented Mar 7, 2019

it's pandas 0.24.1 with this commit applied on top #25289. I haven't tried master but the bug should be valid for 0.24.1.


This comment has been minimized.

Copy link

commented Mar 7, 2019

Thanks for the report. Let us know if you want to work on a fix for this. Something in matplotlib doesn't like extension arrays, which can't be reshaped to 2d arrays. We may need to convert before passing to mpl.


This comment has been minimized.

Copy link

commented Mar 18, 2019

thanks for the prompt fix !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
4 participants
You can’t perform that action at this time.