-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: Formatting of an index that has nan was inconsistent or wrong #3034
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
Conversation
@y-p when you have a chance, can you give this a look-see |
updated |
👍 |
Want to fix up pprint_thing or shall I? |
well that's the thing, when is pprint_thing supposed to hit None? |
None? I don't follow. |
what I meant was pprint_thing(x) is this ever called? (i know it was called I don't see an issue with pprint_thing like it is |
I was thinking of
But, apperantly the repr/to_string methods take care of that, pprint_thing is mutually recursive with pprint_seq, so pprint_thing(None)
I'm sure it justifies that. at least I hope it does. |
ahh yes the case I found was printing of a None index as '' so are we printing NaN or nan ? |
show me a test case., what is a "None index"? In [80]: pd.core.common.pprint_thing(pd.Index([]))
Out[80]: u'[]' I think in normal use where the question of how nans are printed arises, in general. an index is a sequence like any other as far as pprint is concerned. |
@@ -351,12 +351,13 @@ def test_format(self): | |||
# 2845 | |||
index = Index([1, 2.0+3.0j, np.nan]) | |||
formatted = index.format() | |||
expected = [str(index[0]), str(index[1]), str(index[2])] |
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.
here are the 2 cases
first one prints 'nan', but I think we elsewhere print 'NaN'
2nd prints '' (nothing), but I think that's wrong
I marked the 2 tests I changed in test_index |
Should be fine to change pp to print 'None' as 'None' in general. (at least Whether None should be interpreted as None or NaN, would Alternatively, since other objects print nans correcty the other stringify method edit: which is what you've done. |
…g (would fill from other values), (GH2850_) BUG: issue in test_index.py/test_format 1) printing of 'nan' rather than the na_rep (NaN) is inconcistent with everywhere else 2) a 'None' in the index is defacto treated as NaN, is this wrong? CLN: constistency among index for NaN/NaT values
BUG: Formatting of an index that has nan was inconsistent or wrong
Formatting of an index that has
nan
was inconsistent or wrong,(would fill from last value), closes GH #2850
Also changed in test_format.py/test_index
with everywhere else