CLN: Split and fixturized test_fillna in tests/base/test_ops.py by SaturnFromTitan · Pull Request #32483 · pandas-dev/pandas (original) (raw)

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 andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation16 Commits5 Checks0 Files changed

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

@SaturnFromTitan

part of #23877

@SaturnFromTitan

SaturnFromTitan

assert obj is not result
if needs_i8_conversion(o):
@pytest.mark.parametrize("null_obj", [np.nan, None])

Choose a reason for hiding this comment

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

Using nulls_fixture should be taken care of in #32437

ShaharNaveh

Choose a reason for hiding this comment

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

few nits related to #27353

@SaturnFromTitan

@SaturnFromTitan

@MomIsBestFriend Seems like that didn't work for the isinstance(obj, ABCIndex) cases because...

isinstance(pd.Float64Index([]), ABCIndex) is False
isinstance(pd.IntervalIndex([]), ABCIndex) is False
isinstance(pd.CategoricalIndex([]), ABCIndex) is False
...

I'll revert it to a simple isinstance(obj, Index)

@SaturnFromTitan

WillAyd

if len(obj) == 0:
pytest.skip("Test doesn't make sense on empty data")
elif isinstance(obj, ABCMultiIndex):
pytest.skip("MultiIndex doesn't support isna")

Choose a reason for hiding this comment

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

Is this an open issue?

Choose a reason for hiding this comment

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

See my comment below, this is related to MultiIndex not being able to hold "pure" NA values

elif len(obj) < 1:
pytest.skip("Test doesn't make sense on empty data")
elif isinstance(obj, ABCMultiIndex):
pytest.skip(f"MultiIndex can't hold '{null_obj}'")

Choose a reason for hiding this comment

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

Another open issue?

Choose a reason for hiding this comment

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

Isn't this by design? A MultiIndex must hold values on multiple levels, so its elements are tuples. Therefore a MultiIndex can't just hold a raw np.nan or None as a value. Maybe a tuple of nans might make sense, but I don't think that would be recognised as "na" by fillna.

@WillAyd WillAyd added the Testing

pandas testing functions or related to the test suite

label

Mar 6, 2020

@SaturnFromTitan

@SaturnFromTitan

@jreback

thanks @SaturnFromTitan

ideally if you can add the nulls fixture would be great :->

SeeminSyed pushed a commit to CSCD01-team01/pandas that referenced this pull request

Mar 22, 2020

@SaturnFromTitan @SeeminSyed

Labels

Testing

pandas testing functions or related to the test suite