NumPy 1.15.0 Release Notes
NumPy 1.15.0 is a release with an unusual number of cleanups, many deprecations
of old functions, and improvements to many existing functions. Please read the
detailed descriptions below to see if you are affected.
For testing, we have switched to pytest as a replacement for the no longer
maintained nose framework. The old nose based interface remains for downstream
projects who may still be using it.
The Python versions supported by this release are 2.7, 3.4-3.7. The wheels are
linked with OpenBLAS v0.3.0, which should fix some of the linalg problems
reported for NumPy 1.14.
- NumPy has switched to pytest for testing.
- A new
- Many improvements to the histogram functions.
- Support for unicode field names in python 2.7.
- Improved support for PyPy.
- Fixes and improvements to
numpy.lcm, to compute the greatest common divisor and least
numpy.stackarray-joining function generalized to
numpy.quantilefunction, an interface to
percentilewithout factors of
numpy.nanquantilefunction, an interface to
factors of 100
numpy.printoptions, a context manager that sets print options temporarily
for the scope of the
... print(np.array([2.0]) / 3)
numpy.histogram_bin_edges, a function to get the edges of the bins used by a
histogram without needing to calculate the histogram.
have been added to deal with compiler optimization changing the order of
operations. See below for details.
Aliases of builtin
picklefunctions are deprecated, in favor of their
numpy.ma.dump- these functions already failed on
python 3 when called with a string.
Multidimensional indexing with anything but a tuple is deprecated. This means
that the index list in
ind = [slice(None), 0]; arr[ind]should be changed
to a tuple, e.g.,
ind = [slice(None), 0]; arr[tuple(ind)]or
arr[(slice(None), 0)]. That change is necessary to avoid ambiguity in
expressions such as
arr[[[0, 1], [0, 1]]], currently interpreted as
arr[array([0, 1]), array([0, 1])], that will be interpreted
arr[array([[0, 1], [0, 1]])]in the future.
Imports from the following sub-modules are deprecated, they will be removed
at some future date.
Giving a generator to
numpy.sumis now deprecated. This was undocumented
behavior, but worked. Previously, it would calculate the sum of the generator
expression. In the future, it might return a different result. Use
np.sum(np.from_iter(generator))or the built-in Python
Users of the C-API should call
PyArray_DiscardWritbackIfCopyon any array with the
flag set, before deallocating the array. A deprecation warning will be
emitted if those calls are not used when needed.
nditershould use the nditer object as a context manager
anytime one of the iterator operands is writeable, so that numpy can
manage writeback semantics, or should call
RuntimeWarningmay be emitted otherwise in these cases.
np.histogram, deprecated long ago in 1.6.0,
now emits a
- NumPy 1.16 will drop support for Python 3.4.
- NumPy 1.17 will drop support for Python 2.7.
Compiled testing modules renamed and made private
The following compiled modules have been renamed and made private:
umath_tests module is still available for backwards compatibility, but
will be removed in the future.
NpzFile returned by
np.savez is now a
This means it behaves like a readonly dictionary, and has a new
For python 3, this means that
.iterkeys() have been
.items() now return views and not lists.
This is consistent with how the builtin
dict type changed between python 2
and python 3.
Under certain conditions,
nditer must be used in a context manager
When using an
numpy.nditer with the
"readwrite" flags, there
are some circumstances where nditer doesn't actually give you a view of the
writable array. Instead, it gives you a copy, and if you make changes to the
copy, nditer later writes those changes back into your actual array. Currently,
this writeback occurs when the array objects are garbage collected, which makes
this API error-prone on CPython and entirely broken on PyPy. Therefore,
nditer should now be used as a context manager whenever it is used
with writeable arrays, e.g.,
with np.nditer(...) as it: .... You may also
it.close() for cases where a context manager is unusable,
for instance in generator expressions.
Numpy has switched to using pytest instead of nose for testing
The last nose release was 1.3.7 in June, 2015, and development of that tool has
ended, consequently NumPy has now switched to using pytest. The old decorators
and nose tools that were previously used by some downstream projects remain
available, but will not be maintained. The standard testing utilities,
assert_almost_equal and such, are not be affected by this change except for
the nose specific functions
raises. Those functions are
not used in numpy, but are kept for downstream compatibility.
Numpy no longer monkey-patches
Previously numpy added
__array_interface__ attributes to all the integer
np.ma.flatnotmasked_contiguous always return lists
This is the documented behavior, but previously the result could be any of
slice, None, or list.
All downstream users seem to check for the
None result from
flatnotmasked_contiguous and replace it with
. Those callers will
continue to work as before.
np.squeeze restores old behavior of objects that cannot handle an
Prior to version
numpy.squeeze did not have an
axis argument and
all empty axes were removed by default. The incorporation of an
argument made it possible to selectively squeeze single or multiple empty axes,
but the old API expectation was not respected because axes could still be
selectively removed (silent success) from an object expecting all empty axes to
be removed. That silent, selective removal of empty axes for objects expecting
the old behavior has been fixed and the old behavior restored.
unstructured void array's
.item method now returns a bytes object
.item now returns a
bytes object instead of a buffer or byte array.
This may affect code which assumed the return value was mutable, which is no
longer the case.
copy.deepcopy no longer turn
masked into an array
np.ma.masked is a readonly scalar, copying should be a no-op. These
functions now behave consistently with
Multifield Indexing of Structured Arrays will still return a copy
The change that multi-field indexing of structured arrays returns a view
instead of a copy is pushed back to 1.16. A new method
numpy.lib.recfunctions.repack_fields has been introduced to help mitigate
the effects of this change, which can be used to write code compatible with
both numpy 1.15 and 1.16. For more information on how to update code to account
for this future change see the "accessing multiple fields" section of the
user guide <https://docs.scipy.org/doc/numpy/user/basics.rec.html>__.
C API changes
have been added and should be used in place of the
npy_clear_status functions. Optimizing compilers like GCC 8.1 and Clang
were rearranging the order of operations when the previous functions were used
in the ufunc SIMD functions, resulting in the floatstatus flags being checked
before the operation whose status we wanted to check was run. See
PyArray_GetDTypeTransferFunction now defaults to using user-defined
copyswap for user-defined dtypes. If this causes a
significant performance hit, consider implementing
copyswapn to reflect the
have been added and should be used in place of the
npy_clear_statusfunctions. Optimizing compilers like GCC 8.1 and Clang
were rearranging the order of operations when the previous functions were
used in the ufunc SIMD functions, resulting in the floatstatus flags being '
checked before the operation whose status we wanted to check was run.
np.lcm ufuncs added for integer and objects types
These compute the greatest common divisor, and lowest common multiple,
respectively. These work on all the numpy integer types, as well as the
Support for cross-platform builds for iOS
The build system has been modified to add support for the
_PYTHON_HOST_PLATFORM environment variable, used by
compiling on one platform for another platform. This makes it possible to
compile NumPy for iOS targets.
This only enables you to compile NumPy for one specific platform at a time.
Creating a full iOS-compatible NumPy package requires building for the 5
architectures supported by iOS (i386, x86_64, armv7, armv7s and arm64), and
combining these 5 compiled builds products into a single "fat" binary.
return_indices keyword added for
return_indices returns the indices of the two input arrays
that correspond to the common elements.
np.nanpercentile, but takes quantiles in [0, 1]
rather than percentiles in [0, 100].
np.percentile is now a thin wrapper
np.quantile with the extra step of dividing by 100.
Added experimental support for the 64-bit RISC-V architecture.
Syncs einsum path optimization tech between
greedy path has received many enhancements by @jcmgray. A
full list of issues fixed are:
- Arbitrary memory can be passed into the
greedypath. Fixes gh-11210.
- The greedy path has been updated to contain more dynamic programming ideas
preventing a large number of duplicate (and expensive) calls that figure out
the actual pair contraction that takes place. Now takes a few seconds on
several hundred input tensors. Useful for matrix product state theories.
- Reworks the broadcasting dot error catching found in gh-11218 gh-10352 to be
a bit earlier in the process.
- Enhances the
can_dotfunctionality that previous missed an edge case (part
np.ufunc.reduce and related functions now accept an initial value
now accept an
initial keyword argument that specifies the value to start
the reduction with.
np.flip can operate over multiple axes
np.flip now accepts None, or tuples of int, in its
axis argument. If
axis is None, it will flip over all the axes.
histogramdd functions have moved to
These were originally found in
np.lib.function_base. They are still
available under their un-scoped
np.histogram(dd) names, and
to maintain compatibility, aliased at
Code that does
from np.lib.function_base import * will need to be updated
with the new location, and should consider not using
import * in future.
histogram will accept NaN values when explicit bins are given
Previously it would fail when trying to compute a finite range for the data.
Since the range is ignored anyway when the bins are given explicitly, this error
Note that calling
histogram on NaN values continues to raise the
RuntimeWarning s typical of working with nan values, which can be silenced
as usual with
histogram works on datetime types, when explicit bin edges are given
Dates, times, and timedeltas can now be histogrammed. The bin edges must be
passed explicitly, and are not yet computed automatically.
histogram "auto" estimator handles limited variance better
No longer does an IQR of 0 result in
n_bins=1, rather the number of bins
chosen is related to the data size in this situation.
The edges retuned by `histogram
andhistogramdd`` now match the data float type
np.longdouble data, the
returned edges are now of the same dtype. Previously,
histogram would only
return the same type if explicit bins were given, and
float64 bins no matter what the inputs.
histogramdd allows explicit ranges to be given in a subset of axes
range argument of
numpy.histogramdd can now contain
None values to
indicate that the range for the corresponding axis should be computed from the
data. Previously, this could not be specified on a per-axis basis.
The normed arguments of
histogram2d have been renamed
These arguments are now called
density, which is consistent with
histogram. The old argument continues to work, but the new name should be
np.r_ works with 0d arrays, and
np.ma.mr_ works with
0d arrays passed to the
mr_ concatenation helpers are now treated as
though they are arrays of length 1. Previously, passing these was an error.
As a result,
numpy.ma.mr_ now works correctly on the
np.ptp accepts a
keepdims argument, and extended axis tuples
np.ptp (peak-to-peak) can now work over multiple axes, just like
MaskedArray.astype now is identical to
This means it takes all the same arguments, making more code written for
ndarray work for masked array too.
Enable AVX2/AVX512 at compile time
Change to simd.inc.src to allow use of AVX2 or AVX512 at compile time. Previously
compilation for avx2 (or 512) with -march=native would still use the SSE
code for the simd functions even when the rest of the code got AVX2.
nan_to_num always returns scalars when receiving scalar or 0d inputs
Previously an array was returned for integer scalar inputs, which is
inconsistent with the behavior for float inputs, and that of ufuncs in general.
For all types of scalar or 0d input, the result is now a scalar.
np.flatnonzero works on numpy-convertible types
np.flatnonzero now uses
np.ravel(a) instead of
a.ravel(), so it
works for lists, tuples, etc.
np.interp returns numpy scalars rather than builtin scalars
np.interp(0.5, [0, 1], [10, 20]) would return a
now it returns a
np.float64 object, which more closely matches the behavior
of other functions.
Additionally, the special case of
np.interp(object_array_0d, ...) is no
longer supported, as
np.interp(object_array_nd) was never supported anyway.
As a result of this change, the
period argument can now be used on 0d
Allow dtype field names to be unicode in Python 2
np.dtype([(u'name', float)]) would raise a
Python 2, as only bytestrings were allowed in field names. Now any unicode
string field names will be encoded with the
ascii codec, raising a
UnicodeEncodeError upon failure.
This change makes it easier to write Python 2/3 compatible code using
from __future__ import unicode_literals, which previously would cause
string literal field names to raise a TypeError in Python 2.
Comparison ufuncs accept
dtype=object, overriding the default
This allows object arrays of symbolic types, which override
== and other
operators to return expressions, to be compared elementwise with
np.equal(a, b, dtype=object).
sort functions accept
Up until now, to perform a stable sort on the data, the user must do:
>>> np.sort([5, 2, 6, 2, 1], kind='mergesort') [1, 2, 2, 5, 6]
because merge sort is the only stable sorting algorithm available in
NumPy. However, having kind='mergesort' does not make it explicit that
the user wants to perform a stable sort thus harming the readability.
This change allows the user to specify kind='stable' thus clarifying
Do not make temporary copies for in-place accumulation
When ufuncs perform accumulation they no longer make temporary copies because
of the overlap between input an output, that is, the next element accumulated
is added before the accumulated result is stored in its place, hence the
overlap is safe. Avoiding the copy results in faster execution.
linalg.matrix_power can now handle stacks of matrices
Like other functions in
matrix_power can now deal with arrays
of dimension larger than 2, which are treated as stacks of matrices. As part
of the change, to further improve consistency, the name of the first argument
has been changed to
M), and the exceptions for non-square
matrices have been changed to
Increased performance in
random.permutation for multidimensional arrays
permutation uses the fast path in
random.shuffle for all input
array dimensions. Previously the fast path was only used for 1-d arrays.
Generalized ufuncs now accept
One can control over which axes a generalized ufunc operates by passing in an
axes argument, a list of tuples with indices of particular axes. For
instance, for a signature of
(i,j),(j,k)->(i,k) appropriate for matrix
multiplication, the base elements are two-dimensional matrices and these are
taken to be stored in the two last axes of each argument. The corresponding
axes keyword would be
[(-2, -1), (-2, -1), (-2, -1)]. If one wanted to
use leading dimensions instead, one would pass in
[(0, 1), (0, 1), (0, 1)].
For simplicity, for generalized ufuncs that operate on 1-dimensional arrays
(vectors), a single integer is accepted instead of a single-element tuple, and
for generalized ufuncs for which all outputs are scalars, the (empty) output
tuples can be omitted. Hence, for a signature of
for an inner product, one could pass in
axes=[0, 0] to indicate that the
vectors are stored in the first dimensions of the two inputs arguments.
As a short-cut for generalized ufuncs that are similar to reductions, i.e.,
that act on a single, shared core dimension such as the inner product example
above, one can pass an
axis argument. This is equivalent to passing in
axes with identical entries for all arguments with that core dimension
(e.g., for the example above,
Furthermore, like for reductions, for generalized ufuncs that have inputs that
all have the same number of core dimensions and outputs with no core dimension,
one can pass in
keepdims to leave a dimension with size 1 in the outputs,
thus allowing proper broadcasting against the original inputs. The location of
the extra dimension can be controlled with
axes. For instance, for the
keepdims=True, axes=[-2, -2, -2] would act on the
keepdims=True, axis=-2 would act on the
one-but-last dimension of the input arguments, and leave a size 1 dimension in
that place in the output.
float128 values now print correctly on ppc systems
Previously printing float128 values was buggy on ppc, since the special
double-double floating-point-format on these systems was not accounted for.
float128s now print with correct rounding and uniqueness.
Warning to ppc users: You should upgrade glibc if it is version <=2.23,
especially if using float128. On ppc, glibc's malloc in these version often
misaligns allocated memory which can crash numpy when using float128 values.
When used on multidimensional arrays,
argpartition return arrays that are difficult to use as indices.
take_along_axis provides an easy way to use these indices to lookup values
within an array, so that::
np.take_along_axis(a, np.argsort(a, axis=axis), axis=axis)
is the same as::
np.put_along_axis acts as the dual operation for writing to these indices
within an array.
4957a50c1125fdecb4cb51829f5feba1 numpy-1.15.0-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl d5ffa73c6a3eeba8cfcab283e7db3c2f numpy-1.15.0-cp27-cp27m-manylinux1_i686.whl a6f7aa33d4d1598dc33831a4bb36570d numpy-1.15.0-cp27-cp27m-manylinux1_x86_64.whl cbdd2291782deb29f41c9b7d121264e0 numpy-1.15.0-cp27-cp27mu-manylinux1_i686.whl 0bd79da73435161850099bfcacc75fae numpy-1.15.0-cp27-cp27mu-manylinux1_x86_64.whl 73f930c046ac09e518d0b4cf2f8ff642 numpy-1.15.0-cp27-none-win32.whl 7ba5b463728a792dced42fd6259e511f numpy-1.15.0-cp27-none-win_amd64.whl badfc9f713510d59f478037c88b3d963 numpy-1.15.0-cp34-cp34m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl 662f2536cac7b841f86e9b7488e52371 numpy-1.15.0-cp34-cp34m-manylinux1_i686.whl 346d9239f7f12bb7042f8bc847928dc1 numpy-1.15.0-cp34-cp34m-manylinux1_x86_64.whl fd03012584359cd05cee08408df5897d numpy-1.15.0-cp34-none-win32.whl 1032db03cefd82e87f72f2b04b15b7ae numpy-1.15.0-cp34-none-win_amd64.whl cc463ee62af94c8410fdf95ce9933c3c numpy-1.15.0-cp35-cp35m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl 77655199a4e18719dd5a0b348c44fc92 numpy-1.15.0-cp35-cp35m-manylinux1_i686.whl d76c54272549cf3a2165d40d3fea5e30 numpy-1.15.0-cp35-cp35m-manylinux1_x86_64.whl 956c6f7c216b677b27628a97150cd069 numpy-1.15.0-cp35-none-win32.whl 2ab8080576932775167a6f9c772b91e4 numpy-1.15.0-cp35-none-win_amd64.whl 1a01c8d089d488565acc2836d03a7482 numpy-1.15.0-cp36-cp36m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl 5606fa1c1e13e789b802102699d613e2 numpy-1.15.0-cp36-cp36m-manylinux1_i686.whl 5635343a70f7cdd17f372966db1526d3 numpy-1.15.0-cp36-cp36m-manylinux1_x86_64.whl 166e901c1a86da5ffb8c6d3090ed917e numpy-1.15.0-cp36-none-win32.whl 6423497ad5a610c1deed606ce44893bd numpy-1.15.0-cp36-none-win_amd64.whl e232fbba29585812bf7fa547f671b768 numpy-1.15.0-cp37-cp37m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl b2fc4551651fae84eb01b8a37f2e1e69 numpy-1.15.0-cp37-cp37m-manylinux1_i686.whl 36ed60bef7c5cb252b9d0e8dc5029e08 numpy-1.15.0-cp37-cp37m-manylinux1_x86_64.whl 4482a89fa4540c8bbf76028621931266 numpy-1.15.0-cp37-none-win32.whl cfef18ee246468752f1686147c70bd0a numpy-1.15.0-cp37-none-win_amd64.whl 5cf4daff88042326334266f80ad38884 numpy-1.15.0.tar.gz 20e13185089011116a98e11c9bf8aa07 numpy-1.15.0.zip
a17a8fd5df4fec5b56b4d11c9ba8b9ebfb883c90ec361628d07be00aaa4f009a numpy-1.15.0-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl c3ac359ace241707e5a48fe2922e566ac666aacacf4f8031f2994ac429c31344 numpy-1.15.0-cp27-cp27m-manylinux1_i686.whl e2317cf091c2e7f0dacdc2e72c693cc34403ca1f8e3807622d0bb653dc978616 numpy-1.15.0-cp27-cp27m-manylinux1_x86_64.whl 64c6acf5175745fd1b7b7e17c74fdbfb7191af3b378bc54f44560279f41238d3 numpy-1.15.0-cp27-cp27mu-manylinux1_i686.whl 924f37e66db78464b4b85ed4b6d2e5cda0c0416e657cac7ccbef14b9fa2c40b5 numpy-1.15.0-cp27-cp27mu-manylinux1_x86_64.whl 674ea7917f0657ddb6976bd102ac341bc493d072c32a59b98e5b8c6eaa2d5ec0 numpy-1.15.0-cp27-none-win32.whl ae3864816287d0e86ead580b69921daec568fe680857f07ee2a87bf7fd77ce24 numpy-1.15.0-cp27-none-win_amd64.whl 78c35dc7ad184aebf3714dbf43f054714c6e430e14b9c06c49a864fb9e262030 numpy-1.15.0-cp34-cp34m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl c7c660cc0209fdf29a4e50146ca9ac9d8664acaded6b6ae2f5d0ae2e91a0f0cd numpy-1.15.0-cp34-cp34m-manylinux1_i686.whl 3fbccb399fe9095b1c1d7b41e7c7867db8aa0d2347fc44c87a7a180cedda112b numpy-1.15.0-cp34-cp34m-manylinux1_x86_64.whl aaa519335a71f87217ca8a680c3b66b61960e148407bdf5c209c42f50fe30f49 numpy-1.15.0-cp34-none-win32.whl 62cb836506f40ce2529bfba9d09edc4b2687dd18c56cf4457e51c3e7145402fd numpy-1.15.0-cp34-none-win_amd64.whl 55daf757e5f69aa75b4477cf4511bf1f96325c730e4ad32d954ccb593acd2585 numpy-1.15.0-cp35-cp35m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl b5f8c15cb9173f6cdf0f994955e58d1265331029ae26296232379461a297e5f2 numpy-1.15.0-cp35-cp35m-manylinux1_i686.whl 24f3bb9a5f6c3936a8ccd4ddfc1210d9511f4aeb879a12efd2e80bec647b8695 numpy-1.15.0-cp35-cp35m-manylinux1_x86_64.whl 34033b581bc01b1135ca2e3e93a94daea7c739f21a97a75cca93e29d9f0c8e71 numpy-1.15.0-cp35-none-win32.whl f5a758252502b466b9c2b201ea397dae5a914336c987f3a76c3741a82d43c96e numpy-1.15.0-cp35-none-win_amd64.whl 14fb76bde161c87dcec52d91c78f65aa8a23aa2e1530a71f412dabe03927d917 numpy-1.15.0-cp36-cp36m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl 816645178f2180be257a576b735d3ae245b1982280b97ae819550ce8bcdf2b6b numpy-1.15.0-cp36-cp36m-manylinux1_i686.whl f2a778dd9bb3e4590dbe3bbac28e7c7134280c4ec97e3bf8678170ee58c67b21 numpy-1.15.0-cp36-cp36m-manylinux1_x86_64.whl 7f17efe9605444fcbfd990ba9b03371552d65a3c259fc2d258c24fb95afdd728 numpy-1.15.0-cp36-none-win32.whl 73a816e441dace289302e04a7a34ec4772ed234ab6885c968e3ca2fc2d06fe2d numpy-1.15.0-cp36-none-win_amd64.whl 21041014b7529237994a6b578701c585703fbb3b1bea356cdb12a5ea7804241c numpy-1.15.0-cp37-cp37m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl d690a2ff49f6c3bc35336693c9924fe5916be3cc0503fe1ea6c7e2bf951409ee numpy-1.15.0-cp37-cp37m-manylinux1_i686.whl 50718eea8e77a1bedcc85befd22c8dbf5a24c9d2c0c1e36bbb8d7a38da847eb3 numpy-1.15.0-cp37-cp37m-manylinux1_x86_64.whl fb4c33a404d9eff49a0cdc8ead0af6453f62f19e071b60d283f9dc05581e4134 numpy-1.15.0-cp37-none-win32.whl 61efc65f325770bbe787f34e00607bc124f08e6c25fdf04723848585e81560dc numpy-1.15.0-cp37-none-win_amd64.whl 259934a941663e93fdd5d28ce3f6aa2a81ce7dda85c395dd07b1f1edff2e0236 numpy-1.15.0.tar.gz f28e73cf18d37a413f7d5de35d024e6b98f14566a10d82100f9dc491a7d449f9 numpy-1.15.0.zip