Skip to content

Conversation

@mtsokol
Copy link
Contributor

@mtsokol mtsokol commented Aug 16, 2023

Hi!
Due to NumPy's main namespace being changed in numpy/numpy#24376, here I update NumPy's imports/aliases: e.g. np.NaN and np.infty won't be available anymore. Also, a canonical name for NumPy's float and complex should be used, which are np.float64 and np.complex128.

sctypes will be removed from the top namespace, but its destination is not decided yet - therefore I import it from internal np.core for now.



@pytest.mark.parametrize("dt", np.sctypes["float"])
@pytest.mark.parametrize("dt", np.core.sctypes["float"])
Copy link
Member

Choose a reason for hiding this comment

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

If it's not good practice to import from np.core, could you just replace this with the float_numpy_dtype fixture?


@pytest.mark.parametrize("pdt", [Series, DataFrame])
@pytest.mark.parametrize("dt", np.sctypes["int"])
@pytest.mark.parametrize("dt", np.core.sctypes["int"])
Copy link
Member

Choose a reason for hiding this comment

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

Same but with any_signed_int_numpy_dtype

@mroeschke mroeschke added the Compat pandas objects compatability with Numpy or Python functions label Aug 16, 2023
@mroeschke mroeschke added this to the 2.1 milestone Aug 16, 2023
@mroeschke mroeschke merged commit ff86177 into pandas-dev:main Aug 16, 2023
@mroeschke
Copy link
Member

Thanks @mtsokol

@mtsokol mtsokol deleted the update-numpy-namespace-refactor-part-3 branch August 16, 2023 20:21
meeseeksmachine pushed a commit to meeseeksmachine/pandas that referenced this pull request Aug 16, 2023
mroeschke pushed a commit that referenced this pull request Aug 16, 2023
… namespace refactor Part 3) (#54583)

Backport PR #54579: ENH: Reflect changes from `numpy` namespace refactor Part 3

Co-authored-by: Mateusz Sokół <8431159+mtsokol@users.noreply.github.com>
mroeschke pushed a commit to mroeschke/pandas that referenced this pull request Aug 18, 2023
…ev#54579)

* ENH: Reflect changes from numpy namespace refactor part 3

* ENH: Move to fixtures for dtype access
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Compat pandas objects compatability with Numpy or Python functions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants