-
-
Notifications
You must be signed in to change notification settings - Fork 18.3k
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
passing string value to pandas.DataFrame.fillna() & pandas.PivotTable(fill_value) 'breaks' pandas.DataFrame.style.highlight_* inside jupyter notebook #28358
Comments
When you fill with a string, you convert to object dtype. The string I think what you want is a way to control how |
Yes, that is what I'm looking for. I did not know how to properly describe the problem. |
Actually, However, I believe formatting |
Seems reasonable. I think we have similar keywords elsewhere in the library
to control the NA format. Check to make sure we match those names.
…On Sat, Oct 19, 2019 at 5:44 AM Max Chen ***@***.***> wrote:
Actually, highlight_max skips nan values already, and you can pass your
custom function into format to control how nan values are printed in the
output.
However, I believe formatting nan values in the output is *common enough*
that can be included in the "built-in" functions
<https://pandas.pydata.org/pandas-docs/stable/user_guide/style.html#Builtin-styles>
in the Styler. I would like to resolve this issue by adding a formatna
function works someway like: df.style.highlight_max().formatna('-'), is
that OK?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#28358?email_source=notifications&email_token=AAKAOITZYKP3NXAFATCTQGDQPLQJLA5CNFSM4IUYBOO2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBXLPAA#issuecomment-544126848>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAKAOISJIGYLNZWHASIII5LQPLQJLANCNFSM4IUYBOOQ>
.
|
…ing values As described in GH pandas-dev#28358, user who wants to control how NA values are printed while applying styles to the output will have to implement their own formatter. (so that the underlying data will not change and can be used for styling) Since the behavior is common in styling (for reports etc.), suggest to add this shortcut function to enable users format their NA values as something like '--' or 'Not Available' easily. example usage: `df.style.highlight_max().format_null('--')`
The keyword to control NA format is |
…r missing values (#29118) * Add built-in funcion for Styler to format the text displayed for missing values As described in GH #28358, user who wants to control how NA values are printed while applying styles to the output will have to implement their own formatter. (so that the underlying data will not change and can be used for styling)
…r missing values (pandas-dev#29118) * Add built-in funcion for Styler to format the text displayed for missing values As described in GH pandas-dev#28358, user who wants to control how NA values are printed while applying styles to the output will have to implement their own formatter. (so that the underlying data will not change and can be used for styling)
…r missing values (pandas-dev#29118) * Add built-in funcion for Styler to format the text displayed for missing values As described in GH pandas-dev#28358, user who wants to control how NA values are printed while applying styles to the output will have to implement their own formatter. (so that the underlying data will not change and can be used for styling)
i believe this to be closed by the merge and the added tests |
Code Sample, a copy-pastable example if possible
Problem description
pandas.DataFrame.style.highlight_*
does not work on column wherenan
has been replaced by string usingpandas.DataFrame.fillna()
orpandas.PivotTable(fill_value=)
Expected Output
Expected that highlight will still work on column when
fillna
orfill_value
get strings.Output of
pd.show_versions()
INSTALLED VERSIONS
commit : None
python : 3.7.3.final.0
python-bits : 64
OS : Linux
OS-release : 5.0.0-27-generic
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 0.25.1
numpy : 1.17.1
pytz : 2019.2
dateutil : 2.8.0
pip : 19.2.3
setuptools : 41.2.0
Cython : None
pytest : 5.1.1
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : 4.4.1
html5lib : 1.0.1
pymysql : None
psycopg2 : None
jinja2 : 2.10.1
IPython : 7.7.0
pandas_datareader: None
bs4 : 4.8.0
bottleneck : None
fastparquet : None
gcsfs : None
lxml.etree : 4.4.1
matplotlib : 3.1.1
numexpr : None
odfpy : None
openpyxl : 2.6.3
pandas_gbq : None
pyarrow : None
pytables : None
s3fs : None
scipy : 1.3.1
sqlalchemy : 1.3.7
tables : None
xarray : None
xlrd : 1.2.0
xlwt : 1.3.0
xlsxwriter : None
The text was updated successfully, but these errors were encountered: