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

ENH: Styler.highlight_null to accept subset argument #31345

Closed
immaxchen opened this issue Jan 27, 2020 · 0 comments · Fixed by #31350
Closed

ENH: Styler.highlight_null to accept subset argument #31345

immaxchen opened this issue Jan 27, 2020 · 0 comments · Fixed by #31350

Comments

@immaxchen
Copy link
Contributor

Code Sample, a copy-pastable example if possible

import pandas as pd
df = pd.DataFrame({"A": [0, None], "B": [0, None]})
df.style.highlight_null(null_color="red", subset=["A"])

out:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-3-c4119d081571> in <module>
----> 1 df.style.highlight_null(null_color="red", subset=["A"])

TypeError: highlight_null() got an unexpected keyword argument 'subset'

Problem description

Most of the Styler built-in methods support subset argument, except highlight_null.
I think it would be nice if we make it consistent with highlight_min and highlight_max etc.
This also improves the api completeness for missing values styling and formatting. (as discussed here)

Expected Output

Screenshot from 2020-01-27 23-16-43

Output of pd.show_versions()

INSTALLED VERSIONS

commit : None
python : 3.8.1.final.0
python-bits : 64
OS : Linux
OS-release : 3.10.0-862.14.4.el7.x86_64
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8

pandas : 0.25.3
numpy : 1.18.1
pytz : 2019.3
dateutil : 2.8.1
pip : 19.3.1
setuptools : 44.0.0.post20200106
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 2.10.3
IPython : 7.11.1
pandas_datareader: None
bs4 : None
bottleneck : None
fastparquet : None
gcsfs : None
lxml.etree : None
matplotlib : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pytables : None
s3fs : None
scipy : None
sqlalchemy : None
tables : None
xarray : None
xlrd : None
xlwt : None
xlsxwriter : None

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

Successfully merging a pull request may close this issue.

1 participant