BUG: categorical/string Series hist()
method produces confusing bar plot.
#22091
Labels
hist()
method produces confusing bar plot.
#22091
Uh oh!
There was an error while loading. Please reload this page.
Code Sample
Problem description
The
hist()
method creates a plot with multiple colored bars at each label on the x-axis.This kind of plot is not informative and should not be produced.
The same result is obtained using
s.astype('category')
.Expected Output
Either a plot of value counts (see below), OR, alternatively, an exception could be raised.
Note that
DataFrame.hist()
omits object columns, ands.to_frame('i').hist()
raises an exception.Discussion
This is essentially the same question as discussed in #8712 (November 2014). In that issue, the proposal is to create a plot instead of raising an error. This issue is that producing a bad plot is a bug.
cc @jreback , reporter of #8712
Output of
pd.show_versions()
INSTALLED VERSIONS
commit: 114f415
python: 3.7.0.final.0
python-bits: 64
OS: Darwin
OS-release: 14.5.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8
pandas: 0.24.0.dev0+365.g114f41534.dirty
pytest: 3.6.3
pip: 10.0.1
setuptools: 39.0.1
Cython: 0.28.4
numpy: 1.15.0
scipy: 1.1.0
pyarrow: None
xarray: None
IPython: 6.4.0
sphinx: 1.7.6
patsy: None
dateutil: 2.7.3
pytz: 2018.5
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: 2.2.2
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: 1.0.1
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.10
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
gcsfs: None
The text was updated successfully, but these errors were encountered: