chore(deps): update dependency numpy to v1.26.4 #16
Reference in New Issue
Block a user
Delete Branch "renovate/numpy-1.x"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This PR contains the following updates:
1.22.3->1.26.4Release Notes
numpy/numpy
v1.26.4Compare Source
NumPy 1.26.4 Release Notes
NumPy 1.26.4 is a maintenance release that fixes bugs and regressions
discovered after the 1.26.3 release. The Python versions supported by
this release are 3.9-3.12. This is the last planned release in the
1.26.x series.
Contributors
A total of 13 people contributed to this release. People with a "+" by
their names contributed a patch for the first time.
Pull requests merged
A total of 19 pull requests were merged for this release.
numpy.array_api: fixlinalg.choleskyupper decomp...newaxisto__all__innumpy.array_api__config__.pyChecksums
MD5
SHA256
v1.26.3Compare Source
NumPy 1.26.3 Release Notes
NumPy 1.26.3 is a maintenance release that fixes bugs and regressions
discovered after the 1.26.2 release. The most notable changes are the
f2py bug fixes. The Python versions supported by this release are
3.9-3.12.
Compatibility
f2pywill no longer accept ambiguous-mand.pyfCLI combinations.When more than one
.pyffile is passed, an error is raised. When both-mand a.pyfis passed, a warning is emitted and the-mprovidedname is ignored.
Improvements
f2pynow handlescommonblocks which havekindspecifications frommodules. This further expands the usability of intrinsics like
iso_fortran_envandiso_c_binding.Contributors
A total of 18 people contributed to this release. People with a "+" by
their names contributed a patch for the first time.
Pull requests merged
A total of 42 pull requests were merged for this release.
__getitem__innumpy.array_apinewaxisandlinalg.solveinnumpy.array_apilongtypebasein cpu_avx512_knf2pywrappers when modules and subroutines...iso_c_typemappings more consistentlyf2pyrewrite withmesondetailsnumpy/f2py/_backendsfrom main.f2py/*.pyfrom main.Checksums
MD5
SHA256
v1.26.2Compare Source
NumPy 1.26.2 Release Notes
NumPy 1.26.2 is a maintenance release that fixes bugs and regressions
discovered after the 1.26.1 release. The 1.26.release series is the last
planned minor release series before NumPy 2.0. The Python versions
supported by this release are 3.9-3.12.
Contributors
A total of 13 people contributed to this release. People with a "+" by
their names contributed a patch for the first time.
Pull requests merged
A total of 25 pull requests were merged for this release.
import_array()noexceptto shuffle helpersallow-noblasoption to true.np.dtypeto itself doesn't crashChecksums
MD5
SHA256
v1.26.1Compare Source
NumPy 1.26.1 Release Notes
NumPy 1.26.1 is a maintenance release that fixes bugs and regressions
discovered after the 1.26.0 release. In addition, it adds new
functionality for detecting BLAS and LAPACK when building from source.
Highlights are:
The 1.26.release series is the last planned minor release series before
NumPy 2.0. The Python versions supported by this release are 3.9-3.12.
Build system changes
Improved BLAS/LAPACK detection and control
Auto-detection for a number of BLAS and LAPACK is now implemented for
Meson. By default, the build system will try to detect MKL, Accelerate
(on macOS >=13.3), OpenBLAS, FlexiBLAS, BLIS and reference BLAS/LAPACK.
Support for MKL was significantly improved, and support for FlexiBLAS
was added.
New command-line flags are available to further control the selection of
the BLAS and LAPACK libraries to build against.
To select a specific library, use the config-settings interface via
piporpypa/build. E.g., to selectlibblas/liblapack, use:This works not only for the libraries named above, but for any library
that Meson is able to detect with the given name through
pkg-configorCMake.
Besides
-Dblasand-Dlapack, a number of other new flags areavailable to control BLAS/LAPACK selection and behavior:
-Dblas-orderand-Dlapack-order: a list of library names tosearch for in order, overriding the default search order.
-Duse-ilp64: if set totrue, use ILP64 (64-bit integer) BLAS andLAPACK. Note that with this release, ILP64 support has been extended
to include MKL and FlexiBLAS. OpenBLAS and Accelerate were supported
in previous releases.
-Dallow-noblas: if set totrue, allow NumPy to build with itsinternal (very slow) fallback routines instead of linking against an
external BLAS/LAPACK library. The default for this flag may be
changed to ``true`` in a future 1.26.x release, however for
1.26.1 we'd prefer to keep it as ``false`` because if failures
to detect an installed library are happening, we'd like a bug
report for that, so we can quickly assess whether the new
auto-detection machinery needs further improvements.
-Dmkl-threading: to select the threading layer for MKL. There arefour options:
seq,iomp,gompandtbb. The default isauto, which selects from those four as appropriate given theversion of MKL selected.
-Dblas-symbol-suffix: manually select the symbol suffix to use forthe library - should only be needed for linking against libraries
built in a non-standard way.
New features
numpy._coresubmodule stubsnumpy._coresubmodule stubs were added to provide compatibility withpickled arrays created using NumPy 2.0 when running Numpy 1.26.
Contributors
A total of 13 people contributed to this release. People with a "+" by
their names contributed a patch for the first time.
Pull requests merged
A total of 20 pull requests were merged for this release.
-march=native...use-compute-creditsfor Cirrus.NumpyUnpicklerfor backportingnumpy._corestubs. RemoveNumpyUnpicklerChecksums
MD5
SHA256
v1.26.0Compare Source
NumPy 1.26.0 Release Notes
The NumPy 1.26.0 release is a continuation of the 1.25.x release cycle
with the addition of Python 3.12.0 support. Python 3.12 dropped
distutils, consequently supporting it required finding a replacement for
the setup.py/distutils based build system NumPy was using. We have
chosen to use the Meson build system instead, and this is the first
NumPy release supporting it. This is also the first release that
supports Cython 3.0 in addition to retaining 0.29.X compatibility.
Supporting those two upgrades was a large project, over 100 files have
been touched in this release. The changelog doesn't capture the full
extent of the work, special thanks to Ralf Gommers, Sayed Adel, Stéfan
van der Walt, and Matti Picus who did much of the work in the main
development branch.
The highlights of this release are:
The Python versions supported in this release are 3.9-3.12.
New Features
Array API v2022.12 support in
numpy.array_apinumpy.array_apinow full supports thev2022.12 version of the array API standard. Note that this does not
yet include the optional
fftextension in the standard.(gh-23789)
Support for the updated Accelerate BLAS/LAPACK library
Support for the updated Accelerate BLAS/LAPACK library, including ILP64
(64-bit integer) support, in macOS 13.3 has been added. This brings
arm64 support, and significant performance improvements of up to 10x for
commonly used linear algebra operations. When Accelerate is selected at
build time, the 13.3+ version will automatically be used if available.
(gh-24053)
mesonbackend forf2pyf2pyin compile mode (i.e.f2py -c) now accepts the--backend mesonoption. This is the default option for Python3.12on-wards. Older versions will still default to
--backend distutils.To support this in realistic use-cases, in compile mode
f2pytakes a--depflag one or many times which maps todependency()calls in themesonbackend, and does nothing in thedistutilsbackend.There are no changes for users of
f2pyonly as a code generator, i.e.without
-c.(gh-24532)
bind(c)support forf2pyBoth functions and subroutines can be annotated with
bind(c).f2pywill handle both the correct type mapping, and preserve the unique label
for other
Cinterfaces.Note:
bind(c, name = 'routine_name_other_than_fortran_routine')isnot honored by the
f2pybindings by design, sincebind(c)with thenameis meant to guarantee only the same name inCandFortran,not in
PythonandFortran.(gh-24555)
Improvements
iso_c_bindingsupport forf2pyPreviously, users would have to define their own custom
f2cmapfile touse type mappings defined by the Fortran2003
iso_c_bindingintrinsicmodule. These type maps are now natively supported by
f2py(gh-24555)
Build system changes
In this release, NumPy has switched to Meson as the build system and
meson-python as the build backend. Installing NumPy or building a wheel
can be done with standard tools like
pipandpypa/build. Thefollowing are supported:
pip install numpyor (in a cloned repo)pip install .python -m build(preferred), orpip wheel .pip install -e . --no-build-isolationspin:
spin build.All the regular
pipandpypa/buildflags (e.g.,--no-build-isolation) should work as expected.NumPy-specific build customization
Many of the NumPy-specific ways of customizing builds have changed. The
NPY_*environment variables which control BLAS/LAPACK, SIMD,threading, and other such options are no longer supported, nor is a
site.cfgfile to select BLAS and LAPACK. Instead, there arecommand-line flags that can be passed to the build via
pip/build'sconfig-settings interface. These flags are all listed in the
meson_options.txtfile in the root of the repo. Detailed documentedwill be available before the final 1.26.0 release; for now please see
the SciPy "building from source" docs
since most build customization works in an almost identical way in SciPy as it
does in NumPy.
Build dependencies
While the runtime dependencies of NumPy have not changed, the build
dependencies have. Because we temporarily vendor Meson and meson-python,
there are several new dependencies - please see the
[build-system]section of
pyproject.tomlfor details.Troubleshooting
This build system change is quite large. In case of unexpected issues,
it is still possible to use a
setup.py-based build as a temporaryworkaround (on Python 3.9-3.11, not 3.12), by copying
pyproject.toml.setuppytopyproject.toml. However, please open anissue with details on the NumPy issue tracker. We aim to phase out
setup.pybuilds as soon as possible, and therefore would like to seeall potential blockers surfaced early on in the 1.26.0 release cycle.
Contributors
A total of 20 people contributed to this release. People with a "+" by
their names contributed a patch for the first time.
Pull requests merged
A total of 59 pull requests were merged for this release.
_NestedSequence.__getitem__signatureextbuild.pyfrom main.asv devhas been removed, useasv run._umath_linalgdependenciesbindingdirective to "False".castingkeyword tonp.clipfromnumeric.pyiiso_c_bindingtype maps and fixbind(c)...binary_reprto accept any object implementing...dtypeandgenerichashabletyping.assert_typemesonbackend forf2pyspin docs...Checksums
MD5
SHA256
v1.25.2Compare Source
NumPy 1.25.2 Release Notes
NumPy 1.25.2 is a maintenance release that fixes bugs and regressions
discovered after the 1.25.1 release. This is the last planned release in
the 1.25.x series, the next release will be 1.26.0, which will use the
meson build system and support Python 3.12. The Python versions
supported by this release are 3.9-3.11.
Contributors
A total of 13 people contributed to this release. People with a "+" by
their names contributed a patch for the first time.
Pull requests merged
A total of 19 pull requests were merged for this release.
-ftrapping-mathwith Clang on macOSnp.__all__getenvcall used for memory policy warningChecksums
MD5
SHA256
v1.25.1Compare Source
NumPy 1.25.1 Release Notes
NumPy 1.25.1 is a maintenance release that fixes bugs and regressions
discovered after the 1.25.0 release. The Python versions supported by
this release are 3.9-3.11.
Contributors
A total of 10 people contributed to this release. People with a "+" by
their names contributed a patch for the first time.
Pull requests merged
A total of 14 pull requests were merged for this release.
return NULLto begoto fail__array_ufunc__works without any kwargs passedChecksums
MD5
SHA256
v1.25.0Compare Source
NumPy 1.25.0 Release Notes
The NumPy 1.25.0 release continues the ongoing work to improve the
handling and promotion of dtypes, increase the execution speed, and
clarify the documentation. There has also been work to prepare for the
future NumPy 2.0.0 release, resulting in a large number of new and
expired deprecation. Highlights are:
@=).We will be releasing a NumPy 1.26 when Python 3.12 comes out. That is
needed because distutils has been dropped by Python 3.12 and we will be
switching to using meson for future builds. The next mainline release
will be NumPy 2.0.0. We plan that the 2.0 series will still support
downstream projects built against earlier versions of NumPy.
The Python versions supported in this release are 3.9-3.11.
Deprecations
np.core.MachAris deprecated. It is private API. In names definedin
np.coreshould generally be considered private.(gh-22638)
np.finfo(None)is deprecated.(gh-23011)
np.round_is deprecated. Usenp.roundinstead.(gh-23302)
np.productis deprecated. Usenp.prodinstead.(gh-23314)
np.cumproductis deprecated. Usenp.cumprodinstead.(gh-23314)
np.sometrueis deprecated. Usenp.anyinstead.(gh-23314)
np.alltrueis deprecated. Usenp.allinstead.(gh-23314)
Only ndim-0 arrays are treated as scalars. NumPy used to treat all
arrays of size 1 (e.g.,
np.array([3.14])) as scalars. In thefuture, this will be limited to arrays of ndim 0 (e.g.,
np.array(3.14)). The following expressions will report adeprecation warning:
(gh-10615)
numpy.find_common_typeis now deprecated and its useshould be replaced with either
numpy.result_typeornumpy.promote_types. Most users leave the secondscalar_typesargument tofind_common_typeas[]in which casenp.result_typeandnp.promote_typesare both faster and morerobust. When not using
scalar_typesthe main difference is thatthe replacement intentionally converts non-native byte-order to
native byte order. Further,
find_common_typereturnsobjectdtype rather than failing promotion. This leads to differences when
the inputs are not all numeric. Importantly, this also happens for
e.g. timedelta/datetime for which NumPy promotion rules are
currently sometimes surprising.
When the
scalar_typesargument is not[]things are morecomplicated. In most cases, using
np.result_typeand passing thePython values
0,0.0, or0jhas the same result as usingint,float, orcomplexinscalar_types.When
scalar_typesis constructed,np.result_typeis the correctreplacement and it may be passed scalar values like
np.float32(0.0). Passing values other than 0, may lead tovalue-inspecting behavior (which
np.find_common_typenever usedand NEP 50 may change in the future). The main possible change in
behavior in this case, is when the array types are signed integers
and scalar types are unsigned.
If you are unsure about how to replace a use of
scalar_typesorwhen non-numeric dtypes are likely, please do not hesitate to open a
NumPy issue to ask for help.
(gh-22539)
Expired deprecations
np.core.macharandnp.finfo.macharhave been removed.(gh-22638)
+arrwill now raise an error when the dtype is not numeric (andpositive is undefined).
(gh-22998)
A sequence must now be passed into the stacking family of functions
(
stack,vstack,hstack,dstackandcolumn_stack).(gh-23019)
np.clipnow defaults to same-kind casting. Falling back to unsafecasting was deprecated in NumPy 1.17.
(gh-23403)
np.clipwill now propagatenp.nanvalues passed asminormax. Previously, a scalar NaN was usually ignored. This wasdeprecated in NumPy 1.17.
(gh-23403)
The
np.dualsubmodule has been removed.(gh-23480)
NumPy now always ignores sequence behavior for an array-like
(defining one of the array protocols). (Deprecation started NumPy
1.20)
(gh-23660)
The niche
FutureWarningwhen casting to a subarray dtype inastypeor the array creation functions such asasarrayis nowfinalized. The behavior is now always the same as if the subarray
dtype was wrapped into a single field (which was the workaround,
previously). (FutureWarning since NumPy 1.20)
(gh-23666)
==and!=warnings have been finalized. The==and!=operators on arrays now always:
raise errors that occur during comparisons such as when the
arrays have incompatible shapes
(
np.array([1, 2]) == np.array([1, 2, 3])).return an array of all
Trueor allFalsewhen values arefundamentally not comparable (e.g. have different dtypes). An
example is
np.array(["a"]) == np.array([1]).This mimics the Python behavior of returning
FalseandTruewhen comparing incompatible types like
"a" == 1and"a" != 1. For a long time these gaveDeprecationWarningorFutureWarning.(gh-22707)
Nose support has been removed. NumPy switched to using pytest in
2018 and nose has been unmaintained for many years. We have kept
NumPy's nose support to avoid breaking downstream projects who
might have been using it and not yet switched to pytest or some
other testing framework. With the arrival of Python 3.12, unpatched
nose will raise an error. It is time to move on.
Decorators removed:
These are not to be confused with pytest versions with similar
names, e.g., pytest.mark.slow, pytest.mark.skipif,
pytest.mark.parametrize.
Functions removed:
(gh-23041)
The
numpy.testing.utilsshim has been removed. Importing from thenumpy.testing.utilsshim has been deprecated since 2019, the shimhas now been removed. All imports should be made directly from
numpy.testing.(gh-23060)
The environment variable to disable dispatching has been removed.
Support for the
NUMPY_EXPERIMENTAL_ARRAY_FUNCTIONenvironmentvariable has been removed. This variable disabled dispatching with
__array_function__.(gh-23376)
Support for
y=as an alias ofout=has been removed. Thefix,isposinfandisneginffunctions allowed usingy=as a(deprecated) alias for
out=. This is no longer supported.(gh-23376)
Compatibility notes
The
busday_countmethod now correctly handles cases where thebegindatesis later in time than theenddates. Previously, theenddateswas included, even though the documentation states it isalways excluded.
(gh-23229)
When comparing datetimes and timedelta using
np.equalornp.not_equalnumpy previously allowed the comparison withcasting="unsafe". This operation now fails. Forcing the outputdtype using the
dtypekwarg can make the operation succeed, but wedo not recommend it.
(gh-22707)
When loading data from a file handle using
np.load, if the handleis at the end of file, as can happen when reading multiple arrays by
calling
np.loadrepeatedly, numpy previously raisedValueErrorif
allow_pickle=False, andOSErrorifallow_pickle=True. Nowit raises
EOFErrorinstead, in both cases.(gh-23105)
np.padwithmode=wrappads with strict multiples of original dataCode based on earlier version of
padthat usesmode="wrap"willreturn different results when the padding size is larger than initial
array.
np.padwithmode=wrapnow always fills the space with strictmultiples of original data even if the padding size is larger than the
initial array.
(gh-22575)
Cython
long_tandulong_tremovedlong_tandulong_twere aliases forlonglong_tandulonglong_tand confusing (a remainder from of Python 2). This change may lead to
the errors:
We recommend use of bit-sized types such as
cnp.int64_tor the use ofcnp.intp_twhich is 32 bits on 32 bit systems and 64 bits on 64 bitsystems (this is most compatible with indexing). If C
longis desired,use plain
longornpy_long.cnp.int_tis alsolong(NumPy'sdefault integer). However,
longis 32 bit on 64 bit windows and we maywish to adjust this even in NumPy. (Please do not hesitate to contact
NumPy developers if you are curious about this.)
(gh-22637)
Changed error message and type for bad
axesargument toufuncThe error message and type when a wrong
axesvalue is passed toufunc(..., axes=[...])has changed. The message is now moreindicative of the problem, and if the value is mismatched an
AxisErrorwill be raised. ATypeErrorwill still be raised forinvalidinput types.
(gh-22675)
Array-likes that define
__array_ufunc__can now override ufuncs if used aswhereIf the
wherekeyword argument of anumpy.ufunc{.interpreted-textrole="class"} is a subclass of
numpy.ndarray{.interpreted-textrole="class"} or is a duck type that defines
numpy.class.__array_ufunc__{.interpreted-text role="func"} it canoverride the behavior of the ufunc using the same mechanism as the input
and output arguments. Note that for this to work properly, the
where.__array_ufunc__implementation will have to unwrap thewhereargument to pass it into the default implementation of the
ufuncor,for
numpy.ndarray{.interpreted-text role="class"} subclasses beforeusing
super().__array_ufunc__.(gh-23240)
Compiling against the NumPy C API is now backwards compatible by default
NumPy now defaults to exposing a backwards compatible subset of the
C-API. This makes the use of
oldest-supported-numpyunnecessary.Libraries can override the default minimal version to be compatible with
using:
before including NumPy or by passing the equivalent
-Doption to thecompiler. The NumPy 1.25 default is
NPY_1_19_API_VERSION. Because theNumPy 1.19 C API was identical to the NumPy 1.16 one resulting programs
will be compatible with NumPy 1.16 (from a C-API perspective). This
default will be increased in future non-bugfix releases. You can still
compile against an older NumPy version and run on a newer one.
For more details please see
for-downstream-package-authors{.interpreted-text role="ref"}.(gh-23528)
New Features
np.einsumnow accepts arrays withobjectdtypeThe code path will call python operators on object dtype arrays, much
like
np.dotandnp.matmul.(gh-18053)
Add support for inplace matrix multiplication
It is now possible to perform inplace matrix multiplication via the
@=operator.
(gh-21120)
Added
NPY_ENABLE_CPU_FEATURESenvironment variableUsers may now choose to enable only a subset of the built CPU features
at runtime by specifying the
NPY_ENABLE_CPU_FEATURESenvironment variable. Note that these specified features must be outside
the baseline, since those are always assumed. Errors will be raised if
attempting to enable a feature that is either not supported by your CPU,
or that NumPy was not built with.
(gh-22137)
NumPy now has an
np.exceptionsnamespaceNumPy now has a dedicated namespace making most exceptions and warnings
available. All of these remain available in the main namespace, although
some may be moved slowly in the future. The main reason for this is to
increase discoverability and add future exceptions.
(gh-22644)
np.linalgfunctions return NamedTuplesnp.linalgfunctions that return tuples now return namedtuples. Thesefunctions are
eig(),eigh(),qr(),slogdet(), andsvd(). Thereturn type is unchanged in instances where these functions return
non-tuples with certain keyword arguments (like
svd(compute_uv=False)).(gh-22786)
String functions in
np.charare compatible with NEP 42 custom dtypesCustom dtypes that represent unicode strings or byte strings can now be
passed to the string functions in
np.char.(gh-22863)
String dtype instances can be created from the string abstract dtype classes
It is now possible to create a string dtype instance with a size without
using the string name of the dtype. For example,
type(np.dtype('U'))(8)will create a dtype that is equivalent tonp.dtype('U8'). This feature is most useful when writing generic codedealing with string dtype classes.
(gh-22963)
Fujitsu C/C++ compiler is now supported
Support for Fujitsu compiler has been added. To build with Fujitsu
compiler, run:
SSL2 is now supported
Support for SSL2 has been added. SSL2 is a library that provides
OpenBLAS compatible GEMM functions. To enable SSL2, it need to edit
site.cfg and build with Fujitsu compiler. See site.cfg.example.
(gh-22982)
Improvements
NDArrayOperatorsMixinspecifies that it has no__slots__The
NDArrayOperatorsMixinclass now specifies that it contains no__slots__, ensuring that subclasses can now make use of this featurein Python.
(gh-23113)
Fix power of complex zero
np.powernow returns a different result for0^{non-zero}for complexnumbers. Note that the value is only defined when the real part of the
exponent is larger than zero. Previously, NaN was returned unless the
imaginary part was strictly zero. The return value is either
0+0jor0-0j.(gh-18535)
New
DTypePromotionErrorNumPy now has a new
DTypePromotionErrorwhich is used when two dtypescannot be promoted to a common one, for example:
raises this new exception.
(gh-22707)
np.show_configuses information from MesonBuild and system information now contains information from Meson.
np.show_confignow has a new optional parametermodetohelp customize the output.
(gh-22769)
Fix
np.ma.diffnot preserving the mask when called with arguments prepend/append.Calling
np.ma.diffwith arguments prepend and/or append now returns aMaskedArraywith the input mask preserved.Previously, a
MaskedArraywithout the mask was returned.(gh-22776)
Corrected error handling for NumPy C-API in Cython
Many NumPy C functions defined for use in Cython were lacking the
correct error indicator like
except -1orexcept *. These have nowbeen added.
(gh-22997)
Ability to directly spawn random number generators
numpy.random.Generator.spawnnow allows to directly spawn new independentchild generators via the
numpy.random.SeedSequence.spawnmechanism.numpy.random.BitGenerator.spawndoes the same for the underlying bitgenerator.
Additionally,
numpy.random.BitGenerator.seed_seqnow givesdirect access to the seed sequence used for initializing the bit
generator. This allows for example:
safely use rng, child_rng1, and child_rng2
Previously, this was hard to do without passing the
SeedSequenceexplicitly. Please see
numpy.random.SeedSequencefor moreinformation.
(gh-23195)
numpy.logspacenow supports a non-scalarbaseargumentThe
baseargument ofnumpy.logspacecan now be array-like if it isbroadcastable against the
startandstoparguments.(gh-23275)
np.ma.dot()now supports for non-2d arraysPreviously
np.ma.dot()only worked ifaandbwere both 2d. Now itworks for non-2d arrays as well as
np.dot().(gh-23322)
Explicitly show keys of .npz file in repr
NpzFileshows keys of loaded .npz file when printed.(gh-23357)
NumPy now exposes DType classes in
np.dtypesThe new
numpy.dtypesmodule now exposes DType classes and will containfuture dtype related functionality. Most users should have no need to
use these classes directly.
(gh-23358)
Drop dtype metadata before saving in .npy or .npz files
Currently, a
*.npyfile containing a table with a dtype with metadata cannotbe read back. Now,
np.saveandnp.savezdrop metadata before saving.(gh-23371)
numpy.lib.recfunctions.structured_to_unstructuredreturns views in more casesstructured_to_unstructurednow returns a view, if the stride betweenthe fields is constant. Prior, padding between the fields or a reversed
field would lead to a copy. This change only applies to
ndarray,memmapandrecarray. For all other array subclasses, the behaviorremains unchanged.
(gh-23652)
Signed and unsigned integers always compare correctly
When
uint64andint64are mixed in NumPy, NumPy typically promotesboth to
float64. This behavior may be argued about but is confusingfor comparisons
==,<=, since the results returned can be incorrectbut the conversion is hidden since the result is a boolean. NumPy will
now return the correct results for these by avoiding the cast to float.
(gh-23713)
Performance improvements and changes
Faster
np.argsorton AVX-512 enabled processors32-bit and 64-bit quicksort algorithm for np.argsort gain up to 6x speed
up on processors that support AVX-512 instruction set.
Thanks to Intel corporation for sponsoring
this work.
(gh-23707)
Faster
np.sorton AVX-512 enabled processorsQuicksort for 16-bit and 64-bit dtypes gain up to 15x and 9x speed up on
processors that support AVX-512 instruction set.
Thanks to Intel corporation for sponsoring
this work.
(gh-22315)
__array_function__machinery is now much fasterThe overhead of the majority of functions in NumPy is now smaller
especially when keyword arguments are used. This change significantly
speeds up many simple function calls.
(gh-23020)
ufunc.atcan be much fasterGeneric
ufunc.atcan be up to 9x faster. The conditions for thisspeedup:
If ufuncs with appropriate indexed loops on 1d arguments with the above
conditions,
ufunc.atcan be up to 60x faster (an additional 7xspeedup). Appropriate indexed loops have been added to
add,subtract,multiply,floor_divide,maximum,minimum,fmax,and
fmin.The internal logic is similar to the logic used for regular ufuncs,
which also have fast paths.
Thanks to the D. E. Shaw group for sponsoring
this work.
(gh-23136)
Faster membership test on
NpzFileMembership test on
NpzFilewill no longer decompress the archive if itis successful.
(gh-23661)
Changes
np.r_[]andnp.c_[]with certain scalar valuesIn rare cases, using mainly
np.r_with scalars can lead to differentresults. The main potential changes are highlighted by the following:
Where the second example returned:
The first one is due to a signed integer scalar with an unsigned integer
array, while the second is due to
255not fitting intoint8andNumPy currently inspecting values to make this work. (Note that the
second example is expected to change in the future due to
NEP 50 <NEP50>{.interpreted-text role="ref"}; it will then raise anerror.)
(gh-22539)
Most NumPy functions are wrapped into a C-callable
To speed up the
__array_function__dispatching, most NumPy functionsare now wrapped into C-callables and are not proper Python functions or
C methods. They still look and feel the same as before (like a Python
function), and this should only improve performance and user experience
(cleaner tracebacks). However, please inform the NumPy developers if
this change confuses your program for some reason.
(gh-23020)
C++ standard library usage
NumPy builds now depend on the C++ standard library, because the
numpy.core._multiarray_umathextension is linked with the C++ linker.(gh-23601)
Checksums
MD5
SHA256
v1.24.4Compare Source
NumPy 1.24.4 Release Notes
NumPy 1.24.4 is a maintenance release that fixes a few bugs
discovered after the 1.24.3 release. It is the last planned
release in the 1.24.x cycle. The Python versions supported by
this release are 3.8-3.11.
Contributors
A total of 4 people contributed to this release. People with a "+" by
their names contributed a patch for the first time.
Pull requests merged
A total of 6 pull requests were merged for this release.
metadataparameter of...Checksums
MD5
SHA256
v1.24.3Compare Source
NumPy 1.24.3 Release Notes
NumPy 1.24.3 is a maintenance release that fixes bugs and regressions
discovered after the 1.24.2 release. The Python versions supported by
this release are 3.8-3.11.
Contributors
A total of 12 people contributed to this release. People with a "+" by
their names contributed a patch for the first time.
Pull requests merged
A total of 17 pull requests were merged for this release.
__init__.pyi.dargument to fftfreq and rfftfreq as optional...msortlike=dispatched functionsorder="A"ororder="K"Checksums
MD5
SHA256
v1.24.2Compare Source
NumPy 1.24.2 Release Notes
NumPy 1.24.2 is a maintenance release that fixes bugs and regressions
discovered after the 1.24.1 release. The Python versions supported by
this release are 3.8-3.11.
Contributors
A total of 14 people contributed to this release. People with a "+" by
their names contributed a patch for the first time.
Pull requests merged
A total of 17 pull requests were merged for this release.
_Alignofrather thanoffsetof()on most compilersAnyparameter to thenpt.ArrayLike...Checksums
MD5
SHA256
v1.24.1Compare Source
NumPy 1.24.1 Release Notes
NumPy 1.24.1 is a maintenance release that fixes bugs and regressions
discovered after the 1.24.0 release. The Python versions supported by
this release are 3.8-3.11.
Contributors
A total of 12 people contributed to this release. People with a "+" by
their names contributed a patch for the first time.
Pull requests merged
A total of 18 pull requests were merged for this release.
charset_normalizer.Checksums
MD5
SHA256
v1.24.0Compare Source
NumPy 1.24 Release Notes
The NumPy 1.24.0 release continues the ongoing work to improve the
handling and promotion of dtypes, increase the execution speed, and
clarify the documentation. There are also a large number of new and
expired deprecations due to changes in promotion and cleanups. This
might be called a deprecation release. Highlights are
See below for the details,
This release supports Python versions 3.8-3.11.
Deprecations
Deprecate fastCopyAndTranspose and PyArray_CopyAndTranspose
The
numpy.fastCopyAndTransposefunction has been deprecated. Use thecorresponding copy and transpose methods directly:
The underlying C function
PyArray_CopyAndTransposehas also beendeprecated from the NumPy C-API.
(gh-22313)
Conversion of out-of-bound Python integers
Attempting a conversion from a Python integer to a NumPy value will now
always check whether the result can be represented by NumPy. This means
the following examples will fail in the future and give a
DeprecationWarningnow:Many of these did succeed before. Such code was mainly useful for
unsigned integers with negative values such as
np.uint8(-1)givingnp.iinfo(np.uint8).max.Note that conversion between NumPy integers is unaffected, so that
np.array(-1).astype(np.uint8)continues to work and use C integeroverflow logic. For negative values, it will also work to view the
array:
np.array(-1, dtype=np.int8).view(np.uint8). In some cases,using
np.iinfo(np.uint8).maxorval % 2**8may also work well.In rare cases input data may mix both negative values and very large
unsigned values (i.e.
-1and2**63). There it is unfortunatelynecessary to use
%on the Python value or use signed or unsignedconversion depending on whether negative values are expected.
(gh-22385)
Deprecate
msortThe
numpy.msortfunction is deprecated. Usenp.sort(a, axis=0)instead.
(gh-22456)
np.str0and similar are now deprecatedThe scalar type aliases ending in a 0 bit size:
np.object0,np.str0,np.bytes0,np.void0,np.int0,np.uint0as well asnp.bool8arenow deprecated and will eventually be removed.
(gh-22607)
Expired deprecations
The
normedkeyword argument has been removed from[np.histogram]{.title-ref}, [np.histogram2d]{.title-ref}, and
[np.histogramdd]{.title-ref}. Use
densityinstead. Ifnormedwaspassed by position,
densityis now used.(gh-21645)
Ragged array creation will now always raise a
ValueErrorunlessdtype=objectis passed. This includes very deeply nestedsequences.
(gh-22004)
Support for Visual Studio 2015 and earlier has been removed.
Support for the Windows Interix POSIX interop layer has been
removed.
(gh-22139)
Support for Cygwin < 3.3 has been removed.
(gh-22159)
The mini() method of
np.ma.MaskedArrayhas been removed. Useeither
np.ma.MaskedArray.min()ornp.ma.minimum.reduce().The single-argument form of
np.ma.minimumandnp.ma.maximumhasbeen removed. Use
np.ma.minimum.reduce()ornp.ma.maximum.reduce()instead.(gh-22228)
Passing dtype instances other than the canonical (mainly native
byte-order) ones to
dtype=orsignature=in ufuncs will nowraise a
TypeError. We recommend passing the strings"int8"orscalar types
np.int8since the byte-order, datetime/timedeltaunit, etc. are never enforced. (Initially deprecated in NumPy 1.21.)
(gh-22540)
The
dtype=argument to comparison ufuncs is now applied correctly.That means that only
boolandobjectare valid values anddtype=objectis enforced.(gh-22541)
The deprecation for the aliases
np.object,np.bool,np.float,np.complex,np.str, andnp.intis expired (introduces NumPy1.20). Some of these will now give a FutureWarning in addition to
raising an error since they will be mapped to the NumPy scalars in
the future.
(gh-22607)
Compatibility notes
array.fill(scalar)may behave slightly differentnumpy.ndarray.fillmay in some cases behave slightly different now dueto the fact that the logic is aligned with item assignment:
is now identical to:
Previously casting may have produced slightly different answers when
using values that could not be represented in the target
dtypeor whenthe target had
objectdtype.(gh-20924)
Subarray to object cast now copies
Casting a dtype that includes a subarray to an object will now ensure a
copy of the subarray. Previously an unsafe view was returned:
Is now always false. While previously it was true for the specific cast.
(gh-21925)
Returned arrays respect uniqueness of dtype kwarg objects
When the
dtypekeyword argument is used with:py
np.array(){.interpreted-text role="func"} or:py
asarray(){.interpreted-text role="func"}, the dtype of the returnedarray now always exactly matches the dtype provided by the caller.
In some cases this change means that a view rather than the input
array is returned. The following is an example for this on 64bit Linux
where
longandlonglongare the same precision but differentdtypes:Before the change, the
dtypedid not match becausenew is arrwasTrue.(gh-21995)
DLPack export raises
BufferErrorWhen an array buffer cannot be exported via DLPack a
BufferErrorisnow always raised where previously
TypeErrororRuntimeErrorwasraised. This allows falling back to the buffer protocol or
__array_interface__when DLPack was tried first.(gh-22542)
NumPy builds are no longer tested on GCC-6
Ubuntu 18.04 is deprecated for GitHub actions and GCC-6 is not available
on Ubuntu 20.04, so builds using that compiler are no longer tested. We
still test builds using GCC-7 and GCC-8.
(gh-22598)
New Features
New attribute
symboladded to polynomial classesThe polynomial classes in the
numpy.polynomialpackage have a newsymbolattribute which is used to represent the indeterminate of thepolynomial. This can be used to change the value of the variable when
printing:
Note that the polynomial classes only support 1D polynomials, so
operations that involve polynomials with different symbols are
disallowed when the result would be multivariate:
The symbol can be any valid Python identifier. The default is
symbol=x, consistent with existing behavior.(gh-16154)
F2PY support for Fortran
characterstringsF2PY now supports wrapping Fortran functions with:
character x)character, dimension(n) :: x)character(len=10) x)character(len=10), dimension(n, m) :: x)arguments, including passing Python unicode strings as Fortran character
string arguments.
(gh-19388)
New function
np.show_runtimeA new function
numpy.show_runtimehas been added to display theruntime information of the machine in addition to
numpy.show_configwhich displays the build-related information.
(gh-21468)
strictoption fortesting.assert_array_equalThe
strictoption is now available fortesting.assert_array_equal.Setting
strict=Truewill disable the broadcasting behaviour forscalars and ensure that input arrays have the same data type.
(gh-21595)
New parameter
equal_nanadded tonp.uniquenp.uniquewas changed in 1.21 to treat allNaNvalues as equal andreturn a single
NaN. Settingequal_nan=Falsewill restore pre-1.21behavior to treat
NaNsas unique. Defaults toTrue.(gh-21623)
castinganddtypekeyword arguments fornumpy.stackThe
castinganddtypekeyword arguments are now available fornumpy.stack. To use them, writenp.stack(..., dtype=None, casting='same_kind').castinganddtypekeyword arguments fornumpy.vstackThe
castinganddtypekeyword arguments are now available fornumpy.vstack. To use them, writenp.vstack(..., dtype=None, casting='same_kind').castinganddtypekeyword arguments fornumpy.hstackThe
castinganddtypekeyword arguments are now available fornumpy.hstack. To use them, writenp.hstack(..., dtype=None, casting='same_kind').(gh-21627)
The bit generator underlying the singleton RandomState can be changed
The singleton
RandomStateinstance exposed in thenumpy.randommodule is initialized at startup with the
MT19937bit generator. Thenew function
set_bit_generatorallows the default bit generator to bereplaced with a user-provided bit generator. This function has been
introduced to provide a method allowing seamless integration of a
high-quality, modern bit generator in new code with existing code that
makes use of the singleton-provided random variate generating functions.
The companion function
get_bit_generatorreturns the current bitgenerator being used by the singleton
RandomState. This is provided tosimplify restoring the original source of randomness if required.
The preferred method to generate reproducible random numbers is to use a
modern bit generator in an instance of
Generator. The functiondefault_rngsimplifies instantiation:The same bit generator can then be shared with the singleton instance so
that calling functions in the
randommodule will use the same bitgenerator:
The swap is permanent (until reversed) and so any call to functions in
the
randommodule will use the new bit generator. The original can berestored if required for code to run correctly:
(gh-21976)
np.voidnow has adtypeargumentNumPy now allows constructing structured void scalars directly by
passing the
dtypeargument tonp.void.(gh-22316)
Improvements
F2PY Improvements
API anymore
f2pygenerated exception messagesflake8warning fixessignature files are prefixed with
f2py_. For example, one shoulduse
f2py_len(x)instead oflen(x)character(f2py_len=...)is introduced to supportreturning assumed length character strings (e.g.
character(len=*))from wrapper functions
A hook to support rewriting
f2pyinternal data structures afterreading all its input files is introduced. This is required, for
instance, for BC of SciPy support where character arguments are treated
as character strings arguments in
Cexpressions.(gh-19388)
IBM zSystems Vector Extension Facility (SIMD)
Added support for SIMD extensions of zSystem (z13, z14, z15), through
the universal intrinsics interface. This support leads to performance
improvements for all SIMD kernels implemented using the universal
intrinsics, including the following operations: rint, floor, trunc,
ceil, sqrt, absolute, square, reciprocal, tanh, sin, cos, equal,
not_equal, greater, greater_equal, less, less_equal, maximum, minimum,
fmax, fmin, argmax, argmin, add, subtract, multiply, divide.
(gh-20913)
NumPy now gives floating point errors in casts
In most cases, NumPy previously did not give floating point warnings or
errors when these happened during casts. For examples, casts like:
Should now generally give floating point warnings. These warnings should
warn that floating point overflow occurred. For errors when converting
floating point values to integers users should expect invalid value
warnings.
Users can modify the behavior of these warnings using
np.errstate.Note that for float to int casts, the exact warnings that are given may
be platform dependent. For example:
May give a result equivalent to (the intermediate cast means no warning
is given):
May return an undefined result, with a warning set:
The precise behavior is subject to the C99 standard and its
implementation in both software and hardware.
(gh-21437)
F2PY supports the value attribute
The Fortran standard requires that variables declared with the
valueattribute must be passed by value instead of reference. F2PY now
supports this use pattern correctly. So
integer, intent(in), value :: xin Fortran codes will have correctwrappers generated.
(gh-21807)
Added pickle support for third-party BitGenerators
The pickle format for bit generators was extended to allow each bit
generator to supply its own constructor when during pickling. Previous
versions of NumPy only supported unpickling
Generatorinstancescreated with one of the core set of bit generators supplied with NumPy.
Attempting to unpickle a
Generatorthat used a third-party bitgenerators would fail since the constructor used during the unpickling
was only aware of the bit generators included in NumPy.
(gh-22014)
arange() now explicitly fails with dtype=str
Previously, the
np.arange(n, dtype=str)function worked forn=1andn=2, but would raise a non-specific exception message for other valuesof
n. Now, it raises a [TypeError]{.title-ref} informing thatarangedoes not support string dtypes:
(gh-22055)
numpy.typingprotocols are now runtime checkableThe protocols used in
numpy.typing.ArrayLikeandnumpy.typing.DTypeLikeare now properly marked as runtime checkable,making them easier to use for runtime type checkers.
(gh-22357)
Performance improvements and changes
Faster version of
np.isinandnp.in1dfor integer arraysnp.in1d(used bynp.isin) can now switch to a faster algorithm (upto >10x faster) when it is passed two integer arrays. This is often
automatically used, but you can use
kind="sort"orkind="table"toforce the old or new method, respectively.
(gh-12065)
Faster comparison operators
The comparison functions (
numpy.equal,numpy.not_equal,numpy.less,numpy.less_equal,numpy.greaterandnumpy.greater_equal) are now much faster as they are now vectorizedwith universal intrinsics. For a CPU with SIMD extension AVX512BW, the
performance gain is up to 2.57x, 1.65x and 19.15x for integer, float and
boolean data types, respectively (with N=50000).
(gh-21483)
Changes
Better reporting of integer division overflow
Integer division overflow of scalars and arrays used to provide a
RuntimeWarningand the return value was undefined leading to crashesat rare occasions:
Integer division overflow now returns the input dtype's minimum value
and raise the following
RuntimeWarning:(gh-21506)
masked_invalidnow modifies the mask in-placeWhen used with
copy=False,numpy.ma.masked_invalidnow modifies theinput masked array in-place. This makes it behave identically to
masked_whereand better matches the documentation.(gh-22046)
nditer/NpyIterallows all allocating all operandsThe NumPy iterator available through
np.nditerin Python and asNpyIterin C now supports allocating all arrays. The iterator shapedefaults to
()in this case. The operands dtype must be provided,since a "common dtype" cannot be inferred from the other inputs.
(gh-22457)
Checksums
MD5
SHA256
v1.23.5Compare Source
NumPy 1.23.5 Release Notes
NumPy 1.23.5 is a maintenance release that fixes bugs discovered after
the 1.23.4 release and keeps the build infrastructure current. The
Python versions supported for this release are 3.8-3.11.
Contributors
A total of 7 people contributed to this release. People with a "+" by
their names contributed a patch for the first time.
Pull requests merged
A total of 10 pull requests were merged for this release.
random.logseriesChecksums
MD5
SHA256
v1.23.4Compare Source
NumPy 1.23.4 Release Notes
NumPy 1.23.4 is a maintenance release that fixes bugs discovered after
the 1.23.3 release and keeps the build infrastructure current. The main
improvements are fixes for some annotation corner cases, a fix for a
long time
nested_itersmemory leak, and a fix of complex vector dotfor very large arrays. The Python versions supported for this release
are 3.8-3.11.
Note that the mypy version needs to be 0.981+ if you test using Python
3.10.7, otherwise the typing tests will fail.
Contributors
A total of 8 people contributed to this release. People with a "+" by
their names contributed a patch for the first time.
Pull requests merged
A total of 13 pull requests were merged for this release.
__array_api_version__tonumpy.array_apinamespaceget_infofrom "extending with Cython"...lookfor's import try/except againnumpy.typingprotocols as runtime checkableChecksums
MD5
SHA256
v1.23.3Compare Source
NumPy 1.23.3 Release Notes
NumPy 1.23.3 is a maintenance release that fixes bugs discovered after
the 1.23.2 release. There is no major theme for this release, the main
improvements are for some downstream builds and some annotation corner
cases. The Python versions supported for this release are 3.8-3.11.
Note that we will move to MacOS 11 for the NumPy 1.23.4 release, the
10.15 version currently used will no longer be supported by our build
infrastructure at that point.
Contributors
A total of 16 people contributed to this release. People with a "+" by
their names contributed a patch for the first time.
Pull requests merged
A total of 14 pull requests were merged for this release.
__class_getitem__np.equal.reduceraises aTypeErrorChecksums
MD5
SHA256
v1.23.2Compare Source
NumPy 1.23.2 Release Notes
NumPy 1.23.2 is a maintenance release that fixes bugs discovered after
the 1.23.1 release. Notable features are:
The Python versions supported for this release are 3.8-3.11.
Contributors
A total of 9 people contributed to this release. People with a "+" by
their names contributed a patch for the first time.
Pull requests merged
A total of 15 pull requests were merged for this release.
__array_ufunc__typing support to thenin=1ufuncsnp.angledtype-overloads_GenericAliaswrap the underlying classes'...einsumsubscripts to be passed via integer...np.genericrich comparisonssqueezeandtransposemethod to...Popento silently invoke f77 -vChecksums
MD5
SHA256
v1.23.1Compare Source
NumPy 1.23.1 Release Notes
The NumPy 1.23.1 is a maintenance release that fixes bugs discovered
after the 1.23.0 release. Notable fixes are:
The Python version supported for this release are 3.8-3.10.
Contributors
A total of 7 people contributed to this release. People with a "+" by
their names contributed a patch for the first time.
Pull requests merged
A total of 8 pull requests were merged for this release.
keepdimsduring normalization innp.averageand...max_rowsbehaviour innp.loadtxtChecksums
MD5
SHA256
v1.23.0Compare Source
NumPy 1.23.0 Release Notes
The NumPy 1.23.0 release continues the ongoing work to improve the
handling and promotion of dtypes, increase the execution speed, clarify
the documentation, and expire old deprecations. The highlights are:
loadtxtin C, greatly improving its performance.See below for the details,
New functions
A masked array specialization of
ndenumerateis now available asnumpy.ma.ndenumerate. It provides an alternative tonumpy.ndenumerateand skips masked values by default.(gh-20020)
numpy.from_dlpackhas been added to allow easy exchange of datausing the DLPack protocol. It accepts Python objects that implement
the
__dlpack__and__dlpack_device__methods and returns andarray object which is generally the view of the data of the input
object.
(gh-21145)
Deprecations
Setting
__array_finalize__toNoneis deprecated. It must now bea method and may wish to call
super().__array_finalize__(obj)after checking for
Noneor if the NumPy version is sufficientlynew.
(gh-20766)
Using
axis=32(axis=np.MAXDIMS) in many cases had the samemeaning as
axis=None. This is deprecated andaxis=Nonemust beused instead.
(gh-20920)
The hook function
PyDataMem_SetEventHookhas been deprecated andthe demonstration of its use in tool/allocation_tracking has been
removed. The ability to track allocations is now built-in to python
via
tracemalloc.(gh-20394)
numpy.distutilshas been deprecated, as a result ofdistutilsitself being deprecated. It will not be present in NumPy for
Python >= 3.12, and will be removed completely 2 years after the
release of Python 3.12 For more details, see
distutils-status-migration{.interpreted-text role="ref"}.(gh-20875)
numpy.loadtxtwill now give aDeprecationWarningwhen an integerdtypeis requested but the value is formatted as a floating point number.(gh-21663)
Expired deprecations
The
NpzFile.iteritems()andNpzFile.iterkeys()methods have beenremoved as part of the continued removal of Python 2 compatibility.
This concludes the deprecation from 1.15.
(gh-16830)
The
alenandasscalarfunctions have been removed.(gh-20414)
The
UPDATEIFCOPYarray flag has been removed together with theenum
NPY_ARRAY_UPDATEIFCOPY. The associated (and deprecated)PyArray_XDECREF_ERRwas also removed. These were all deprecated in1.14. They are replaced by
WRITEBACKIFCOPY, that requires callingPyArray_ResoveWritebackIfCopybefore the array is deallocated.(gh-20589)
Exceptions will be raised during array-like creation. When an object
raised an exception during access of the special attributes
__array__or__array_interface__, this exception was usuallyignored. This behaviour was deprecated in 1.21, and the exception
will now be raised.
(gh-20835)
Multidimensional indexing with non-tuple values is not allowed.
Previously, code such as
arr[ind]whereind = [[0, 1], [0, 1]]produced a
FutureWarningand was interpreted as a multidimensionalindex (i.e.,
arr[tuple(ind)]). Now this example is treated like anarray index over a single dimension (
arr[array(ind)]).Multidimensional indexing with anything but a tuple was deprecated
in NumPy 1.15.
(gh-21029)
Changing to a dtype of different size in F-contiguous arrays is no
longer permitted. Deprecated since Numpy 1.11.0. See below for an
extended explanation of the effects of this change.
(gh-20722)
New Features
crackfortran has support for operator and assignment overloading
crackfortranparser now understands operator and assignmentdefinitions in a module. They are added in the
bodylist of the modulewhich contains a new key
implementedbylisting the names of thesubroutines or functions implementing the operator or assignment.
(gh-15006)
f2py supports reading access type attributes from derived type statements
As a result, one does not need to use
publicorprivatestatementsto specify derived type access properties.
(gh-15844)
New parameter
ndminadded togenfromtxtThis parameter behaves the same as
ndminfromnumpy.loadtxt.(gh-20500)
np.loadtxtnow supports quote character and single converter functionnumpy.loadtxtnow supports an additionalquotecharkeyword argumentwhich is not set by default. Using
quotechar='"'will read quotedfields as used by the Excel CSV dialect.
Further, it is now possible to pass a single callable rather than a
dictionary for the
convertersargument.(gh-20580)
Changing to dtype of a different size now requires contiguity of only the last axis
Previously, viewing an array with a dtype of a different item size
required that the entire array be C-contiguous. This limitation would
unnecessarily force the user to make contiguous copies of non-contiguous
arrays before being able to change the dtype.
This change affects not only
ndarray.view, but other constructionmechanisms, including the discouraged direct assignment to
ndarray.dtype.This change expires the deprecation regarding the viewing of
F-contiguous arrays, described elsewhere in the release notes.
(gh-20722)
Deterministic output files for F2PY
For F77 inputs,
f2pywill generatemodname-f2pywrappers.funconditionally, though these may be empty. For free-form inputs,
modname-f2pywrappers.f,modname-f2pywrappers2.f90will both begenerated unconditionally, and may be empty. This allows writing generic
output rules in
cmakeormesonand other build systems. Olderbehavior can be restored by passing
--skip-empty-wrapperstof2py.f2py-meson{.interpreted-text role="ref"} details usage.(gh-21187)
keepdimsparameter foraverageThe parameter
keepdimswas added to the functionsnumpy.averageandnumpy.ma.average. The parameter has the same meaning as it does inreduction functions such as
numpy.sumornumpy.mean.(gh-21485)
New parameter
equal_nanadded tonp.uniquenp.uniquewas changed in 1.21 to treat allNaNvalues as equal andreturn a single
NaN. Settingequal_nan=Falsewill restore pre-1.21behavior to treat
NaNsas unique. Defaults toTrue.(gh-21623)
Compatibility notes
1D
np.linalg.normpreserves float input types, even for scalar resultsPreviously, this would promote to
float64when theordargument wasnot one of the explicitly listed values, e.g.
ord=3:This change affects only
float32andfloat16vectors withordother than
-Inf,0,1,2, andInf.(gh-17709)
Changes to structured (void) dtype promotion and comparisons
In general, NumPy now defines correct, but slightly limited, promotion
for structured dtypes by promoting the subtypes of each field instead of
raising an exception:
For promotion matching field names, order, and titles are enforced,
however padding is ignored. Promotion involving structured dtypes now
always ensures native byte-order for all fields (which may change the
result of
np.concatenate) and ensures that the result will be"packed", i.e. all fields are ordered contiguously and padding is
removed. See
structured_dtype_comparison_and_promotion{.interpreted-textrole="ref"} for further details.
The
reprof aligned structures will now never print the long formincluding
offsetsanditemsizeunless the structure includes paddingnot guaranteed by
align=True.In alignment with the above changes to the promotion logic, the casting
safety has been updated:
"equiv"enforces matching names and titles. The itemsize isallowed to differ due to padding.
"safe"allows mismatching field names and titlesfield.
field. Previously, the field names were used and only unsafe casts
were possible when names mismatched.
The main important change here is that name mismatches are now
considered "safe" casts.
(gh-19226)
NPY_RELAXED_STRIDES_CHECKINGhas been removedNumPy cannot be compiled with
NPY_RELAXED_STRIDES_CHECKING=0anymore.Relaxed strides have been the default for many years and the option was
initially introduced to allow a smoother transition.
(gh-20220)
np.loadtxthas recieved several changesThe row counting of
numpy.loadtxtwas fixed.loadtxtignores fullyempty lines in the file, but counted them towards
max_rows. Whenmax_rowsis used and the file contains empty lines, these will now notbe counted. Previously, it was possible that the result contained fewer
than
max_rowsrows even though more data was available to be read. Ifthe old behaviour is required,
itertools.islicemay be used:While generally much faster and improved,
numpy.loadtxtmay now failto converter certain strings to numbers that were previously
successfully read. The most important cases for this are:
1.0into integers is nowdeprecated.
0x3p3will fail_was previously accepted as a thousands delimiter100_000.This will now result in an error.
If you experience these limitations, they can all be worked around by
passing appropriate
converters=. NumPy now supports passing a singleconverter to be used for all columns to make this more convenient. For
example,
converters=float.fromhexcan read hexadecimal float numbersand
converters=intwill be able to read100_000.Further, the error messages have been generally improved. However, this
means that error types may differ. In particularly, a
ValueErrorisnow always raised when parsing of a single entry fails.
(gh-20580)
Improvements
ndarray.__array_finalize__is now callableThis means subclasses can now use
super().__array_finalize__(obj)without worrying whether
ndarrayis their superclass or not. Theactual call remains a no-op.
(gh-20766)
Add support for VSX4/Power10
With VSX4/Power10 enablement, the new instructions available in Power
ISA 3.1 can be used to accelerate some NumPy operations, e.g.,
floor_divide, modulo, etc.
(gh-20821)
np.fromiternow accepts objects and subarraysThe
numpy.fromiterfunction now supports object and subarray dtypes.Please see he function documentation for examples.
(gh-20993)
Math C library feature detection now uses correct signatures
Compiling is preceded by a detection phase to determine whether the
underlying libc supports certain math operations. Previously this code
did not respect the proper signatures. Fixing this enables compilation
for the
wasm-ldbackend (compilation for web assembly) and reduces thenumber of warnings.
(gh-21154)
np.kronnow maintains subclass informationnp.kronmaintains subclass information now such as masked arrays whilecomputing the Kronecker product of the inputs
⚠️ Warning,
np.kronoutput now followsufuncordering (multiply) to determinethe output class type
(gh-21262)
Performance improvements and changes
Faster
np.loadtxtnumpy.loadtxtis now generally much faster than previously as most ofit is now implemented in C.
(gh-20580)
Faster reduction operators
Reduction operations like
numpy.sum,numpy.prod,numpy.add.reduce,numpy.logical_and.reduceon contiguous integer-based arrays are nowmuch faster.
(gh-21001)
Faster
np.wherenumpy.whereis now much faster than previously on unpredictable/randominput data.
(gh-21130)
Faster operations on NumPy scalars
Many operations on NumPy scalars are now significantly faster, although
rare operations (e.g. with 0-D arrays rather than scalars) may be slower
in some cases. However, even with these improvements users who want the
best performance for their scalars, may want to convert a known NumPy
scalar into a Python one using
scalar.item().(gh-21188)
Faster
np.kronnumpy.kronis about 80% faster as the product is now computed usingbroadcasting.
(gh-21354)
Checksums
MD5
SHA256
v1.22.4Compare Source
NumPy 1.22.4 Release Notes
NumPy 1.22.4 is a maintenance release that fixes bugs discovered after
the 1.22.3 release. In addition, the wheels for this release are built
using the recently released Cython 0.29.30, which should fix the
reported problems with
debugging.
The Python versions supported for this release are 3.8-3.10. Note that
the Mac wheels are now based on OS X 10.15 rather than 10.6 that was
used in previous NumPy release cycles.
Contributors
A total of 12 people contributed to this release. People with a "+" by
their names contributed a patch for the first time.
Pull requests merged
A total of 22 pull requests were merged for this release.
np.lib.stride_tricksre-exported under the...numpy._typingnpy_memchrwithno_sanitize("alignment")on clangChecksums
MD5
SHA256
Configuration
📅 Schedule: At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by Renovate Bot.
chore(deps): update dependency numpy to v1.22.4to chore(deps): update dependency numpy to v1.23.03148df0074tof17273a001chore(deps): update dependency numpy to v1.23.0to chore(deps): update dependency numpy to v1.23.1f17273a001to78abd63d46chore(deps): update dependency numpy to v1.23.1to chore(deps): update dependency numpy to v1.23.278abd63d46to8b52c6dae3chore(deps): update dependency numpy to v1.23.2to chore(deps): update dependency numpy to v1.23.38b52c6dae3toe04fed0368chore(deps): update dependency numpy to v1.23.3to chore(deps): update dependency numpy to v1.23.4e04fed0368to0952c90b72chore(deps): update dependency numpy to v1.23.4to chore(deps): update dependency numpy to v1.23.50952c90b72to28fd3174cfchore(deps): update dependency numpy to v1.23.5to chore(deps): update dependency numpy to v1.24.028fd3174cftof9b0243a79chore(deps): update dependency numpy to v1.24.0to chore(deps): update dependency numpy to v1.24.1f9b0243a79tob913ae9680chore(deps): update dependency numpy to v1.24.1to chore(deps): update dependency numpy to v1.24.2b913ae9680to5fb63600835fb6360083toa0e7d2afe6chore(deps): update dependency numpy to v1.24.2to chore(deps): update dependency numpy to v1.24.3a0e7d2afe6to6cd80f3ddbchore(deps): update dependency numpy to v1.24.3to chore(deps): update dependency numpy to v1.25.0⚠ Artifact update problem
Renovate failed to update an artifact related to this branch. You probably do not want to merge this PR as-is.
♻ Renovate will retry this branch, including artifacts, only when one of the following happens:
The artifact failure details are included below:
File name: poetry.lock
6cd80f3ddbto61cbd31b77chore(deps): update dependency numpy to v1.25.0to chore(deps): update dependency numpy to v1.25.161cbd31b77tod883cc91c7d883cc91c7to2081fe8c202081fe8c20toe0fc64f892chore(deps): update dependency numpy to v1.25.1to chore(deps): update dependency numpy to v1.25.2e0fc64f892tob026e69e3dchore(deps): update dependency numpy to v1.25.2to chore(deps): update dependency numpy to v1.26.0b026e69e3dto8f3a190a43chore(deps): update dependency numpy to v1.26.0to chore(deps): update dependency numpy to v1.26.18f3a190a43tof26d0029d1chore(deps): update dependency numpy to v1.26.1to chore(deps): update dependency numpy to v1.26.2f26d0029d1to4bd2f99b7fchore(deps): update dependency numpy to v1.26.2to chore(deps): update dependency numpy to v1.26.34bd2f99b7fto8a293ae29echore(deps): update dependency numpy to v1.26.3to chore(deps): update dependency numpy to v1.26.48a293ae29etoce0d891bf4ce0d891bf4to86d4089d2686d4089d26to0548a578610548a57861to4a7cd2b0e34a7cd2b0e3tob3c3412609b3c3412609toc288e42e5fView command line instructions
Checkout
From your project repository, check out a new branch and test the changes.