Skip to content
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

MAINT: Remove np.int_ and np.uint #55369

Merged
merged 1 commit into from
Oct 3, 2023

Conversation

mtsokol
Copy link
Contributor

@mtsokol mtsokol commented Oct 3, 2023

Hi!
This PR addresses changes that will be shipped in numpy/numpy#24794 - deprecation of np.int_ and np.uint. An explanation of changes:

  • In places where np.int_(value) was used I replaced it with backward compatible np_long(value).
  • If dtypes were directly compared I replaced np.int_ with np.dtype(int) (they are equivalent).
  • For dtype= arguments I used int for conciseness.

@mtsokol mtsokol force-pushed the remove-int_-and-uint branch from c755e00 to 0ea5e62 Compare October 3, 2023 11:35
@mtsokol mtsokol force-pushed the remove-int_-and-uint branch from 0ea5e62 to 9e65df2 Compare October 3, 2023 11:52
np_long = np.int_
np_ulong = np.uint
else:
np_long = np.int_
Copy link
Member

Choose a reason for hiding this comment

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

So just for my understanding, np.long was newly added to the top level namespace/didn't exist before a certain version? It would be preferable to already use np.long/np.ulong if possible

Copy link
Contributor Author

@mtsokol mtsokol Oct 3, 2023

Choose a reason for hiding this comment

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

That's correct - np.long and np.ulong throw AttributeError in existing numpy versions - these will be new members of the main namespace (I think np.long existed for some time a long time ago).

@mroeschke mroeschke added the Compat pandas objects compatability with Numpy or Python functions label Oct 3, 2023
@mroeschke mroeschke added this to the 2.1.2 milestone Oct 3, 2023
@mroeschke mroeschke merged commit 4976b69 into pandas-dev:main Oct 3, 2023
@mroeschke
Copy link
Member

Thanks again @mtsokol

meeseeksmachine pushed a commit to meeseeksmachine/pandas that referenced this pull request Oct 3, 2023
@mtsokol mtsokol deleted the remove-int_-and-uint branch October 3, 2023 23:00
@mtsokol
Copy link
Contributor Author

mtsokol commented Oct 3, 2023

I think I need to add one warning filter, similar to scipy scipy/scipy#19341 that I did today - in case you experience failures with the current numpy nightly.

mroeschke pushed a commit that referenced this pull request Oct 4, 2023
…int`) (#55387)

Backport PR #55369: MAINT: Remove `np.int_` and `np.uint`

Co-authored-by: Mateusz Sokół <8431159+mtsokol@users.noreply.github.com>
mtsokol added a commit to mtsokol/pandas that referenced this pull request Oct 13, 2023
@mtsokol
Copy link
Contributor Author

mtsokol commented Oct 13, 2023

These changes should be reverted in #55505, and also reverse-backported to 2.1.x.

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