-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Remove unused, avoid uses of deprecated api #22071
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #22071 +/- ##
=======================================
Coverage 92.07% 92.07%
=======================================
Files 170 170
Lines 50690 50690
=======================================
Hits 46672 46672
Misses 4018 4018
Continue to review full report at Codecov.
|
void set_array_not_contiguous(PyArrayObject* ao) { | ||
ao->flags &= ~(NPY_ARRAY_C_CONTIGUOUS | NPY_ARRAY_F_CONTIGUOUS); | ||
// Numpy>=1.8-compliant equivalent to: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we are numpy >= 1.9! can this be simplified?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. The existing implementation uses the deprecated numpy API.
@@ -1,10 +1,18 @@ | |||
from numpy cimport ndarray |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wait, we have a tslibs/util.pxd and a util.pxd?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When util.pxd was moved from src to tslibs, we added _libs/util.pxd as an alias so as to keep existing cimports
An update/background on the ever-present numpy deprecation warnings. Based on conversation on the cython tracker it looks like a) numpy more or less forgot why they did that deprecation, have no plans to follow up on it AFAICT we get the deprecation warning if we do one or more of:
iii) c) But any C file we add this to becomes off-limits for cython files that have numpy cimports (or else we get compile-time errors) The upshot being: there are a bunch of files for which we can get rid of these warnings. Many of the files only have numpy cimports because they need to a) call These can all be worked around if we get numpy cimports out of util (which this PR does) |
from cpython cimport PyTypeObject | ||
|
||
cdef extern from *: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't need this in util.pxd? (the higher level one)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this change perf?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this change perf?
No.
we don't need this in util.pxd? (the higher level one)?
a) everything in this file is cimported into the other one, so it is available there. b) No, this is only used by tslibs.period.
pandas/core/dtypes/common.py
Outdated
@@ -304,34 +304,6 @@ def is_offsetlike(arr_or_obj): | |||
return False | |||
|
|||
|
|||
def is_period(arr): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this not generally exposed to the user / higher level? I don't remember why we added this (and it has the wrong name)
pandas/core/dtypes/common.py
Outdated
Parameters | ||
---------- | ||
arr : array-like | ||
The array-like to check. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unfortunately I think we need to deprecate this (and remove in next version)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't this change orthogonal to this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't this change orthogonal to this PR?
Sure, can be separated out. This started out as a grab-bag PR.
unfortunately I think we need to deprecate this (and remove in next version)
Darn, OK.
the warnings in the log seem more than before on interval.pyx. but could be just me. |
A couple PRs back that fixed a bunch of warnings, changes to interval.pyx were reverted because they caused failures on windows. So this file has been cleaned up much less than the others, might seem like more in comparison. |
thanks! |
core.dtypes.common.is_period
is confusingly named and never used. This PR gets rid of it.The deprecated numpy API that causes zillions of warnings includes
ndarray.data
, so this replaces the old usage with the encouraged usage.A bunch of
tslibs.util
isn't actually used in tslibs.util, so the relevant functions are moved up to_libs.util
.Docstrings for most of what's left in tslibs.util.
Simplify util._checknull by removing an unnecessary try/except.