Skip to content

BUG: repr of inf values with use_inf_as_na #55483

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

Merged
merged 2 commits into from
Oct 11, 2023

Conversation

jbrockmendel
Copy link
Member

@jbrockmendel jbrockmendel commented Oct 11, 2023

The real motivation here is avoiding the special-casing in _format_with_header.

This makes is_float_nan unnecessary, so rips it out.

@jbrockmendel jbrockmendel requested a review from WillAyd as a code owner October 11, 2023 02:45
@@ -411,7 +411,7 @@ def test_to_records_with_na_record(self):
def test_to_records_with_inf_as_na_record(self):
# GH 48526
expected = """ NaN inf record
0 NaN b [0, inf, b]
0 inf b [0, inf, b]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If use_inf_as_na is enabled, shouldn't inf still be rendered as NaN?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, we still should render the "inf" accurately Notice on L413 that we already do this when the inf is in the columns

@mroeschke mroeschke added the Output-Formatting __repr__ of pandas objects, to_string label Oct 11, 2023
@mroeschke mroeschke added this to the 2.2 milestone Oct 11, 2023
@mroeschke mroeschke merged commit 943c3cb into pandas-dev:main Oct 11, 2023
@mroeschke
Copy link
Member

Thanks @jbrockmendel

@jbrockmendel jbrockmendel deleted the bug-format-inf branch October 11, 2023 17:56
gupta-paras pushed a commit to gupta-paras/pandas that referenced this pull request Oct 12, 2023
* BUG: repr of inf values with use_inf_as_na

* GH ref
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Output-Formatting __repr__ of pandas objects, to_string
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants