Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
BUG: Don't ignore na_rep in DataFrame.to_html #36690
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
BUG: Don't ignore na_rep in DataFrame.to_html #36690
Changes from 13 commits
e1614ae
f56d893
247e79b
f33e4d0
e83b7ed
a240b49
7ee3ef2
72a812a
ca57e06
dd25388
4a599b2
dc6287a
faa8e2c
1374cdd
c81aa04
52f16fc
8c46ab7
6cb161c
b166ffc
199c560
5a054d7
4423dd7
0c49eb0
4b53c91
87c172a
265e2a8
8f0ca15
7be7c38
5a50ad0
1af22a5
37cc78c
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually this entire section you added should be instead on L1440
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and you will want to do something like
you will want to factor that out into a function and use it above in 2 (or more places)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I understand,
get_result_as_array
never actually gets called here. Are you thinking the formatter should already be handling NaN?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no my point is to share code; you are doing virtually the same thing, just in another way
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok I see what you mean
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm not sure about using "nan" when
na_rep
is "NaN", although that is the string output of"{:.2f}".format(np.nan)
.Maybe could use
lib.no_default
forna_rep
, raise iffloat_format
also specified and use "NaN" iffloat_format
not specified.maybe worth considering passing
np.nan
tofunc
if passed tofloat_format
, and if result is a string assumefunc
handles missing values, something likeand then use
na_rep
iffunc_handles_na
isFalse
. but I'm not sure if we gain anything.The main issue with the custom formatters (applies to
formatters
kwarg as well) is that we do not give complete control to the custom formatter. off the top of my head, strings maybe trimmed, spaces added, precision changed, truncation applied.The other issue is that the EAs use the custom formatters. So this is not necessarily an easy issue to fix in isolation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for html tests, can use expected_html fixture. see test_to_html_justify for usage as template.