Skip to content

ENH: Update numpy exceptions imports #54405

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 2 commits into from
Aug 7, 2023

Conversation

mtsokol
Copy link
Contributor

@mtsokol mtsokol commented Aug 4, 2023

Due to NumPy's main namespace being changed in numpy/numpy#24316, here I update warning imports.

@mtsokol mtsokol force-pushed the update-np-exceptions-imports branch from 5d26681 to 4362824 Compare August 4, 2023 12:28
Copy link
Member

@lithomas1 lithomas1 left a comment

Choose a reason for hiding this comment

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

Thanks for the PR.

Left a minor comment.

@@ -236,7 +238,8 @@ def asarray_tuplesafe(values: Iterable, dtype: NpDtype | None = None) -> ArrayLi
try:
with warnings.catch_warnings():
# Can remove warning filter once NumPy 1.24 is min version
warnings.simplefilter("ignore", np.VisibleDeprecationWarning)
if Version(np.__version__) < Version("1.24.0"):
Copy link
Member

Choose a reason for hiding this comment

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

you can use

np_version_gte1p24 = _nlv >= Version("1.24")

instead here and below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure! I updated it to use these helpers.

@mroeschke mroeschke added the Compat pandas objects compatability with Numpy or Python functions label Aug 4, 2023
@mtsokol mtsokol force-pushed the update-np-exceptions-imports branch from 0ce64e0 to 3894c6e Compare August 7, 2023 08:25
@mroeschke mroeschke added this to the 2.1 milestone Aug 7, 2023
@mroeschke mroeschke merged commit 78c79b9 into pandas-dev:main Aug 7, 2023
@mroeschke
Copy link
Member

Thanks @mtsokol

@mtsokol mtsokol deleted the update-np-exceptions-imports branch August 7, 2023 17:50
mroeschke pushed a commit to mroeschke/pandas that referenced this pull request Aug 18, 2023
* ENH: Update numpy exceptions imports

* ENH: Use version checks from dedicated utils
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.

3 participants