Skip to content

Plotting boolean data fails #23719

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

Closed
BSchilperoort opened this issue Nov 15, 2018 · 2 comments · Fixed by #27665
Closed

Plotting boolean data fails #23719

BSchilperoort opened this issue Nov 15, 2018 · 2 comments · Fixed by #27665
Labels
Milestone

Comments

@BSchilperoort
Copy link

Code example

import pandas as pd
df = pd.DataFrame({'data': [True, False, False]})
df['data'].plot()

Problem description

Plotting boolean data returns TypeError: Empty 'DataFrame': no numeric data to plot.
Matplotlib interprets boolean data as 0/1, which allows plotting.

Expected Output

A plot of the boolean data like matplotlib would make (interpreting True/False as 1/0).

Output of pd.show_versions()

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

commit: None
python: 3.6.4.final.0
python-bits: 64
OS: Windows
OS-release: 7
machine: AMD64
processor: Intel64 Family 6 Model 78 Stepping 3, GenuineIntel
byteorder: little
LC_ALL: None
LANG: en
LOCALE: None.None

pandas: 0.23.4
pytest: 3.3.2
pip: 9.0.1
setuptools: 38.4.0
Cython: 0.27.3
numpy: 1.14.2
scipy: 1.0.0
pyarrow: None
xarray: 0.10.9
IPython: 6.2.1
sphinx: 1.6.6
patsy: 0.5.0
dateutil: 2.6.1
pytz: 2017.3
blosc: None
bottleneck: 1.2.1
tables: 3.4.2
numexpr: 2.6.4
feather: None
matplotlib: 2.1.2
openpyxl: 2.4.10
xlrd: 1.1.0
xlwt: 1.3.0
xlsxwriter: 1.0.2
lxml: 4.1.1
bs4: 4.6.0
html5lib: 1.0.1
sqlalchemy: 1.2.1
pymysql: None
psycopg2: None
jinja2: 2.10
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None

@BSchilperoort BSchilperoort changed the title Plotting boolean data Plotting boolean data fails Nov 15, 2018
@gfyoung
Copy link
Member

gfyoung commented Nov 16, 2018

@BSchilperoort : Good catch! Investigation and PR are welcome!

cc @TomAugspurger

@BSchilperoort
Copy link
Author

Added the simple fix in a PR: #23813

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants