Skip to content

Fix numpy warning #35085

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 6 commits into from
Jul 6, 2020
Merged

Conversation

TomAugspurger
Copy link
Contributor

No description provided.

@@ -257,7 +257,7 @@ def nselect_method(request):
# Missing values & co.
# ----------------------------------------------------------------
@pytest.fixture(
params=[None, np.nan, pd.NaT, float("nan"), np.float("NaN"), pd.NA], ids=str
params=[None, np.nan, pd.NaT, float("nan"), float("nan"), pd.NA], ids=str
)
Copy link
Member

Choose a reason for hiding this comment

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

i dont think we want to float("nan")s in here. maybe this should be np.float64("nan")? best guess is the point of having this in addition to np.nan is bc nan is not a singleton like pd.NaT.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is equivalent to what we had before, since np.float was an alias for float. You're saying that isn't what we want?

Copy link
Member

Choose a reason for hiding this comment

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

just speculating; im pretty confident we dont want two identical objects in here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah I missed that we already had float('"nan").

@jreback jreback added Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate Testing pandas testing functions or related to the test suite labels Jul 2, 2020
@TomAugspurger
Copy link
Contributor Author

Various failures like

=================================== FAILURES ===================================

_______________ TestIndex.test_isin_nan_common_object[nan0-nan2] _______________

[gw0] linux -- Python 3.8.3 /home/travis/miniconda3/envs/pandas-dev/bin/python

self = <pandas.tests.indexes.test_base.TestIndex object at 0x7ff81c8b2e80>

nulls_fixture = nan, nulls_fixture2 = nan

    def test_isin_nan_common_object(self, nulls_fixture, nulls_fixture2):

        # Test cartesian product of null fixtures and ensure that we don't

        # mangle the various types (save a corner case with PyPy)

    

        # all nans are the same

        if (

            isinstance(nulls_fixture, float)

            and isinstance(nulls_fixture2, float)

            and math.isnan(nulls_fixture)

            and math.isnan(nulls_fixture2)

        ):

>           tm.assert_numpy_array_equal(

                Index(["a", nulls_fixture]).isin([nulls_fixture2]),

                np.array([False, True]),

            )

which I can't look into at the moment. I'll just remove the duplicate key.

@TomAugspurger TomAugspurger merged commit 15884f3 into pandas-dev:master Jul 6, 2020
@TomAugspurger TomAugspurger deleted the numpydev-warning branch July 6, 2020 15:19
@TomAugspurger TomAugspurger added this to the 1.1 milestone Jul 6, 2020
jbrockmendel pushed a commit to jbrockmendel/pandas that referenced this pull request Jul 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants