Skip to content

CLN: Split and fixturized test_fillna in tests/base/test_ops.py #32483

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

Conversation

SaturnFromTitan
Copy link
Contributor

part of #23877

  • tests added / passed
  • passes black pandas
  • passes git diff upstream/master -u -- "*.py" | flake8 --diff


if needs_i8_conversion(o):
@pytest.mark.parametrize("null_obj", [np.nan, None])
Copy link
Contributor Author

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

Copy link
Member

@ShaharNaveh ShaharNaveh left a comment

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
Copy link
Contributor Author

SaturnFromTitan commented Mar 6, 2020

@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)

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")
Copy link
Member

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?

Copy link
Contributor Author

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}'")
Copy link
Member

Choose a reason for hiding this comment

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

Another open issue?

Copy link
Contributor Author

@SaturnFromTitan SaturnFromTitan Mar 8, 2020

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
@jreback jreback added this to the 1.1 milestone Mar 11, 2020
@jreback jreback merged commit 7fa8ee7 into pandas-dev:master Mar 11, 2020
@jreback
Copy link
Contributor

jreback commented Mar 11, 2020

thanks @SaturnFromTitan

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants