Description
Summary
This is a tracking issue for all of the things that (will) need to change for numpy 2.0
xref numpy/numpy#24306
Edit 2023-08-03: Updated to list according to numpy/numpy#24306 (comment)
- Note that almost all (aside from
NaN
andInf
fall into the "tentative" category, which is to say possibly removed, but not fully decided.
Edit 2023-08-31: Updated to list according to most recent numpy list
Proposed fix
List of functions affected
Most of the changes are relatively simple namespace swaps... but if we wish to be backwards compatible, may require some finagling in the interim
Some of these we may wish to advocate with numpy to keep, particularly some of the things we use that numpy would say "use scipy" for, as I don't think we are prepared to take on scipy as a dependency.
Some of them (e.g. hanning/blackman window functions) it may be better to just vendor or deprecate mlab functions/change examples to avoid using them (we already vendor GaussianKDE...)
Removed from top level, kept/moved to np.linalg
-
np.cross
- used in proj3d.py, art3d.py
-
np.inner
- used in test_patches.py
-
np.outer
- used several places
-
np.transpose
- used in several places, often with list inputs
Removed from top level, moved to np.dtypes
-
np.iscomplexobj
- used in mlab.py
-
np.isreal
- used in cbook.py, bezier.py, test_mlab.py
-
np.isscalar
- used in _axes.py, cbook.py, figure.py
-
np.issubdtype
- used in several places, usually in conjuction with other things that are moving
-
np.min_scalar_type
- used in colors.py
-
np.promote_types
- used in stackplot.py, colors.py
Removed from top level, moved to np.rec
-
np.recarray
MAINT: Reflect changes fromnumpy
namespace refactor Part 5 #26664- used in examples only
Removed from top level, kept in np.index_tricks
-
np.c_
- used in angle_annotation example only
-
np.r_
- used in test_agg.py and demo_agg_filter.py (example)
Removed in favor of alias/similar func
-
np.Inf
(almost certain to be removed, trivial to replace) Remove soon to be deprecated nan/inf aliases #26458- use
np.inf
- only in test
- use
-
np.NaN
(almost certain to be removed, trivial to replace) Remove soon to be deprecated nan/inf aliases #26458- use
np.nan
- only in test
- use
-
np.array_split
- use
np.split
- used in legend.py
- use
-
np.in1D
MAINT: Numpy 2.0 deprecations for row_stack and in1d #26566- use
np.isin
- used in test_triangulation.py
- use
-
np.nanmin/max
- sounds like the idea is to do
np.max(..., nan='ignore')
or similar instead of separate, parallel funcs - discussion tends towards slower deprecation on these
- sounds like the idea is to do
-
np.polyfit/polyval
- use
np.polynomial.Polynomial.fit
- used in examples/docs only
- use
-
np.roots
- comment is "move to polynomial?"
- used in bezier.py
-
np.rowstack
MAINT: Numpy 2.0 deprecations for row_stack and in1d #26566- use
np.vstack
- used in several locations
- use
Fully removed (?)
-
np.isfortran
- used in test_triangulation.py
-
np.putmask
- used in colors.py
- may be replaced by
a[mask]=b[mask]
, but doesn't do repeating behavior, so would have to verif - comment supports the idea that a simple replacement is possible
-
np.s_
- used in cbook, 3dplot example
Possibly renamed, but not settled
np.ix_
- used in _triinterpolate.py, test_image.py