What's new in Numpy (Numerical Python) 1.23.0 RC 1

May 29, 2022
  • It provides:
  • A powerful N-dimensional array object
  • Sophisticated (broadcasting) functions
  • Tools for integrating C/C++ and Fortran code
  • Useful linear algebra, Fourier transform, and random number capabilities
  • And much more

New in Numpy (Numerical Python) 1.22.0 (Jan 2, 2022)

  • It provides:
  • a powerful N-dimensional array object
  • sophisticated (broadcasting) functions
  • tools for integrating C/C++ and Fortran code
  • useful linear algebra, Fourier transform, and random number capabilities
  • and much more

New in Numpy (Numerical Python) 1.19.2 (Sep 11, 2020)

  • A powerful N-dimensional array object
  • Sophisticated (broadcasting) functions
  • Tools for integrating C/C++ and Fortran code
  • Useful linear algebra, Fourier transform, and random number capabilities
  • And much more

New in Numpy (Numerical Python) 1.18.4 (May 3, 2020)

  • A powerful N-dimensional array object
  • Sophisticated (broadcasting) functions
  • Tools for integrating C/C++ and Fortran code
  • Useful linear algebra, Fourier transform, and random number capabilities
  • And much more

New in Numpy (Numerical Python) 1.18.3 (Apr 20, 2020)

  • A powerful N-dimensional array object
  • Sophisticated (broadcasting) functions
  • Tools for integrating C/C++ and Fortran code
  • Useful linear algebra, Fourier transform, and random number capabilities
  • And much more

New in Numpy (Numerical Python) 1.16.4 (May 29, 2019)

  • It provides:
  • A powerful N-dimensional array object
  • Sophisticated (broadcasting) functions
  • Tools for integrating C/C++ and Fortran code
  • Useful linear algebra, Fourier transform, and random number capabilities
  • And much more

New in Numpy (Numerical Python) 1.10.2 (Jun 1, 2018)

  • Issues Fixed:
  • gh-6019 Masked array repr fails for structured array with multi-dimensional column.
  • gh-6462 Median of empty array produces IndexError.
  • gh-6467 Performance regression for record array access.
  • gh-6468 numpy.interp uses 'left' value even when x[0]==xp[0].
  • gh-6475 np.allclose returns a memmap when one of its arguments is a memmap.
  • gh-6491 Error in broadcasting stride_tricks array.
  • gh-6495 Unrecognized command line option '-ffpe-summary' in gfortran.
  • gh-6497 Failure of reduce operation on recarrays.
  • gh-6498 Mention change in default casting rule in 1.10 release notes.
  • gh-6530 The partition function errors out on empty input.
  • gh-6532 numpy.inner return wrong inaccurate value sometimes.
  • gh-6563 Intent(out) broken in recent versions of f2py.
  • gh-6569 Cannot run tests after 'python setup.py build_ext -i'
  • gh-6572 Error in broadcasting stride_tricks array component.
  • gh-6575 BUG: Split produces empty arrays with wrong number of dimensions
  • gh-6590 Fortran Array problem in numpy 1.10.
  • gh-6602 Random __all__ missing choice and dirichlet.
  • gh-6611 ma.dot no longer always returns a masked array in 1.10.
  • gh-6618 NPY_FORTRANORDER in make_fortran() in numpy.i
  • gh-6636 Memory leak in nested dtypes in numpy.recarray
  • gh-6641 Subsetting recarray by fields yields a structured array.
  • gh-6667 ma.make_mask handles ma.nomask input incorrectly.
  • gh-6675 Optimized blas detection broken in master and 1.10.
  • gh-6678 Getting unexpected error from: X.dtype = complex (or Y = X.view(complex))
  • gh-6718 f2py test fail in pip installed numpy-1.10.1 in virtualenv.
  • gh-6719 Error compiling Cython file: Pythonic division not allowed without gil.
  • gh-6771 Numpy.rec.fromarrays losing dtype metadata between versions 1.9.2 and 1.10.1
  • gh-6781 The travis-ci script in maintenance/1.10.x needs fixing.
  • gh-6807 Windows testing errors for 1.10.2
  • Merged PRs:
  • The following PRs have been merged into 1.10.2. When the PR is a backport,
  • the PR number for the original PR against master is listed.
  • gh-5773 MAINT: Hide testing helper tracebacks when using them with pytest.
  • gh-6094 BUG: Fixed a bug with string representation of masked structured arrays.
  • gh-6208 MAINT: Speedup field access by removing unneeded safety checks.
  • gh-6460 BUG: Replacing the os.environ.clear by less invasive procedure.
  • gh-6470 BUG: Fix AttributeError in numpy distutils.
  • gh-6472 MAINT: Use Python 3.5 instead of 3.5-dev for travis 3.5 testing.
  • gh-6474 REL: Update Paver script for sdist and auto-switch test warnings.
  • gh-6478 BUG: Fix Intel compiler flags for OS X build.
  • gh-6481 MAINT: LIBPATH with spaces is now supported Python 2.7+ and Win32.
  • gh-6487 BUG: Allow nested use of parameters in definition of arrays in f2py.
  • gh-6488 BUG: Extend common blocks rather than overwriting in f2py.
  • gh-6499 DOC: Mention that default casting for inplace operations has changed.
  • gh-6500 BUG: Recarrays viewed as subarrays don't convert to np.record type.
  • gh-6501 REL: Add "make upload" command for built docs, update "make dist".
  • gh-6526 BUG: Fix use of __doc__ in setup.py for -OO mode.
  • gh-6527 BUG: Fix the IndexError when taking the median of an empty array.
  • gh-6537 BUG: Make ma.atleast_* with scalar argument return arrays.
  • gh-6538 BUG: Fix ma.masked_values does not shrink mask if requested.
  • gh-6546 BUG: Fix inner product regression for non-contiguous arrays.
  • gh-6553 BUG: Fix partition and argpartition error for empty input.
  • gh-6556 BUG: Error in broadcast_arrays with as_strided array.
  • gh-6558 MAINT: Minor update to "make upload" doc build command.
  • gh-6562 BUG: Disable view safety checks in recarray.
  • gh-6567 BUG: Revert some import * fixes in f2py.
  • gh-6574 DOC: Release notes for Numpy 1.10.2.
  • gh-6577 BUG: Fix for #6569, allowing build_ext --inplace
  • gh-6579 MAINT: Fix mistake in doc upload rule.
  • gh-6596 BUG: Fix swig for relaxed stride checking.
  • gh-6606 DOC: Update 1.10.2 release notes.
  • gh-6614 BUG: Add choice and dirichlet to numpy.random.__all__.
  • gh-6621 BUG: Fix swig make_fortran function.
  • gh-6628 BUG: Make allclose return python bool.
  • gh-6642 BUG: Fix memleak in _convert_from_dict.
  • gh-6643 ENH: make recarray.getitem return a recarray.
  • gh-6653 BUG: Fix ma dot to always return masked array.
  • gh-6668 BUG: ma.make_mask should always return nomask for nomask argument.
  • gh-6686 BUG: Fix a bug in assert_string_equal.
  • gh-6695 BUG: Fix removing tempdirs created during build.
  • gh-6697 MAINT: Fix spurious semicolon in macro definition of PyArray_FROM_OT.
  • gh-6698 TST: test np.rint bug for large integers.
  • gh-6717 BUG: Readd fallback CBLAS detection on linux.
  • gh-6721 BUG: Fix for #6719.
  • gh-6726 BUG: Fix bugs exposed by relaxed stride rollback.
  • gh-6757 BUG: link cblas library if cblas is detected.
  • gh-6756 TST: only test f2py, not f2py2.7 etc, fixes #6718.
  • gh-6747 DEP: Deprecate changing shape of non-C-contiguous array via descr.
  • gh-6775 MAINT: Include from __future__ boilerplate in some files missing it.
  • gh-6780 BUG: metadata is not copied to base_dtype.
  • gh-6783 BUG: Fix travis ci testing for new google infrastructure.
  • gh-6785 BUG: Quick and dirty fix for interp.
  • gh-6813 TST,BUG: Make test_mvoid_multidim_print work for 32 bit systems.
  • gh-6817 BUG: Disable 32-bit msvc9 compiler optimizations for npy_rint.
  • gh-6819 TST: Fix test_mvoid_multidim_print failures on Python 2.x for Windows.

New in Numpy (Numerical Python) 1.11.2 RC 1 (Sep 12, 2016)

  • Fixes overridden by later merges and release notes updates are omitted.
  • BUG: Many functions silently drop 'keepdims' kwarg.
  • ENH: Add extra kwargs and update doc of many MA methods.
  • DOC: Update Numpy 1.11.1 release notes.
  • BUG: MaskedArray.count treats negative axes incorrectly.
  • BUG: Fix array too big error for wide dtypes.
  • BUG: Make sure npy_mul_with_overflow_ detects overflow.
  • MAINT: Allocate fewer bytes for empty arrays.
  • MAINT,DOC: Fix some imp module uses and update f2py.compile docstring.
  • MAINT: Fix remaining uses of deprecated Python imp module.
  • BLD: Fix ATLAS version detection
  • BUG: Construct ma.array from np.array which contains padding.
  • BUG: Fix float16 type not being called due to wrong ordering.
  • BUG: Production install of numpy should not require nose.
  • BLD: Fixed MKL detection for recent versions of this library.
  • BUG: Fix for issue
  • (ma.median of 1d).
  • BUG: Monkey-patch _msvccompile.gen_lib_option like other compilers. #7939 BUG: Check for HAVE_LDOUBLE_DOUBLE_DOUBLE_LE in npy_math_complex.
  • BUG: Guard against buggy comparisons in generic quicksort.
  • BUG: Use keyword arguments to initialize Extension base class.
  • BUG: Make sure numpy globals keep identity after reload.
  • BUG: MSVCCompiler grows 'lib' & 'include' env strings exponentially.
  • BLD: Remove __NUMPY_SETUP__ from builtins at end of setup.py.
  • MAINT: Remove leftover imp module imports.
  • BUG: Fix return of np.ma.count if keepdims is True and axis is None.
  • BUG: Fix numpy.ma.median.
  • BUG: Fix np.ma.median with only one non-masked value.
  • BUG: Fix bug in NpyIter buffering with discontinuous arrays.

New in Numpy (Numerical Python) 1.10.2 RC 1 (Nov 13, 2015)

  • Compatibility notes:
  • Relaxed stride checking revealed a bug in ``array_is_fortran(a)``, that was using PyArray_ISFORTRAN to check for Fortran contiguity instead of PyArray_IS_F_CONTIGUOUS. You may want to regenerate swigged files using the updated numpy.i
  • Issues Fixed:
  • gh-6462 Median of empty array produces IndexError.
  • gh-6467 Performance regression for record array access.
  • gh-6475 np.allclose returns a memmap when one of its arguments is a memmap.
  • gh-6491 Error in broadcasting stride_tricks array.
  • gh-6495 Unrecognized command line option '-ffpe-summary' in gfortran.
  • gh-6497 Failure of reduce operation on recarrays.
  • gh-6498 Mention change in default casting rule in 1.10 release notes.
  • gh-6530 The partition function errors out on empty input.
  • gh-6563 Intent(out) broken in recent versions of f2py.
  • gh-6569 Cannot run tests after 'python setup.py build_ext -i'
  • gh-6572 Error in broadcasting stride_tricks array component.
  • gh-6575 BUG: Split produces empty arrays with wrong number of dimensions
  • gh-6590 Fortran Array problem in numpy 1.10.
  • gh-6602 Random __all__ missing choice and dirichlet.
  • gh-6611 ma.dot no longer always returns a masked array in 1.10.
  • gh-6618 NPY_FORTRANORDER in make_fortran() in numpy.i
  • gh-6636 Memory leak in nested dtypes in numpy.recarray
  • gh-6641 Subsetting recarray by fields yields a structured array.
  • gh-6667 ma.make_mask handles ma.nomask input incorrectly.
  • Merged PRs:
  • gh-5773 MAINT: Hide testing helper tracebacks when using them with pytest.
  • gh-6208 MAINT: Speedup field access by removing unnee
  • ded safety checks.
  • gh-6460 BUG: Replacing the os.environ.clear by less invasive procedure.
  • gh-6470 BUG: Fix AttributeError in numpy distutils.
  • gh-6472 MAINT: Use Python 3.5 instead of 3.5-dev for travis 3.5 testing.
  • gh-6474 REL: Update Paver script for sdist and auto-switch test warnings.
  • gh-6478 BUG: Fix Intel compiler flags for OS X build.
  • gh-6481 MAINT: LIBPATH with spaces is now supported Python 2.7+ and Win32.
  • gh-6487 BUG: Allow nested use of parameters in definition of arrays in f2py.
  • gh-6488 BUG: Extend common blocks rather than overwriting in f2py.
  • gh-6499 DOC: Mention that default casting for inplace operations has changed.
  • gh-6500 BUG: Recarrays viewed as subarrays don't convert to np.record type.
  • gh-6501 REL: Add "make upload" command for built docs, update "make dist".
  • gh-6526 BUG: Fix use of __doc__ in setup.py for -OO mode.
  • gh-6527 BUG: Fix the IndexError when taking the median of an empty array.
  • gh-6537 BUG: Make ma.atleast_
  • with scalar argument return arrays.
  • gh-6538 BUG: Fix ma.masked_values does not shrink mask if requested.
  • gh-6546 BUG: Fix inner product regression for non-contiguous arrays.
  • gh-6553 BUG: Fix partition and argpartition error for empty input.
  • gh-6556 BUG: Error in broadcast_arrays with as_strided array.
  • gh-6558 MAINT: Minor update to "make upload" doc build command.
  • gh-6562 BUG: Disable view safety checks in recarray.
  • gh-6567 BUG: Revert some import
  • fixes in f2py.
  • gh-6574 DOC: Release notes for Numpy 1.10.2.
  • gh-6577 BUG: Fix for #6569, allowing build_ext --inplace
  • gh-6579 MAINT: Fix mistake in doc upload rule.
  • gh-6596 BUG: Fix swig for relaxed stride checking.
  • gh-6606 DOC: Update 1.10.2 release notes.
  • gh-6614 BUG: Add choice and dirichlet to numpy.random.__all__.
  • gh-6621 BUG: Fix swig make_fortran function.
  • gh-6628 BUG: Make allclose return python bool.
  • gh-6642 BUG: Fix memleak in _convert_from_dict.
  • gh-6643 ENH: make recarray.getitem return a recarray.
  • gh-6653 BUG: Fix ma dot to always return masked array.
  • gh-6668 BUG: ma.make_mask should always return nomask for nomask argument.
  • Initial support for mingwpy was reverted as it was causing problems for non-windows builds.
  • gh-6536 BUG: Revert gh-5614 to fix non-windows build problems A fix for np.lib.split was reverted because it resulted in "fixing" behavior will be present in the Numpy 1.11 and was already present in Numpy 1.9. See the discussion of the issue at gh-6575 for clarification.
  • gh-6576 BUG: Revert gh-6376 to fix split behavior for empty arrays.

New in Numpy (Numerical Python) 1.10.0 Beta 1 (Aug 12, 2015)

  • Highlights:
  • numpy.distutils now supports parallel compilation via the --parallel/-j argument passed to setup.py build
  • numpy.distutils now supports additional customization via site.cfg to control compilation parameters, i.e. runtime libraries, extra linking/compilation flags.
  • Addition of *np.linalg.multi_dot*: compute the dot product of two or more arrays in a single function call, while automatically selecting the fastest evaluation order.
  • The new function `np.stack` provides a general interface for joining a sequence of arrays along a new axis, complementing `np.concatenate` for joining along an existing axis.
  • Addition of `nanprod` to the set of nanfunctions.
  • Support for the '@' operator in Python 3.5.
  • Future Changes:
  • The _dotblas module has been removed. CBLAS Support is now in Multiarray.
  • The testcalcs.py file has been removed.
  • The polytemplate.py file has been removed.
  • npy_PyFile_Dup and npy_PyFile_DupClose have been removed from npy_3kcompat.h. splitcmdline has been removed from numpy/distutils/exec_command.py.
  • try_run and get_output have been removed from numpy/distutils/command/config.py
  • The a._format attribute is no longer supported for array printing.
  • Keywords ``skiprows`` and ``missing`` removed from np.genfromtxt.
  • Keyword ``old_behavior`` removed from np.correlate.

New in Numpy (Numerical Python) 1.9.2 (Mar 2, 2015)

  • fix too large dtype alignment of strings and complex types
  • fix ma.median when used on ndarrays
  • Fix astype for structured array fields of different byte order
  • fix segfault when clipping complex arrays
  • allow np.argpartition on non ndarrays
  • Fixes ndarray.fill to accept full range of uint64
  • Fix loadtxt with comments=None and a string None data
  • Masked array view fails if structured dtype has datetime component
  • Make RandomState.set_state and RandomState.get_state threadsafe
  • make seed, randint and shuffle threadsafe
  • Fixed incorrect assert_array_almost_equal_nulp documentation
  • Add support for ATLAS > 3.9.33.
  • PyArray_AsCArray caused segfault for 3d arrays
  • handle out of memory in rfftf
  • fix a few bugs in the random.pareto docstring
  • minor changes to linspace docstring
  • fix a compile issues on AIX

New in Numpy (Numerical Python) 1.9.2 RC 1 (Feb 11, 2015)

  • Issues fixed:
  • fix too large dtype alignment of strings and complex types
  • fix ma.median when used on ndarrays
  • Fix astype for structured array fields of different byte order
  • Fix loadtxt with comments=None and a string None data
  • Masked array view fails if structured dtype has datetime component
  • Make RandomState.set_state and RandomState.get_state threadsafe
  • make seed, randint and shuffle threadsafe
  • Fixed incorrect assert_array_almost_equal_nulp documentation
  • Add support for ATLAS > 3.9.33.
  • PyArray_AsCArray caused segfault for 3d arrays
  • handle out of memory in rfftf
  • fix a few bugs in the random.pareto docstring
  • minor changes to linspace docstring
  • fix a compile issues on AIX

New in Numpy (Numerical Python) 1.9.1 RC 1 (Oct 27, 2014)

  • Issues fixed:
  • restore linear edge behaviour of gradient to as it was in < 1.9. The second order behaviour is available via the `edge_order` keyword
  • workaround Accelerate sgemv crash on OSX 10.9
  • restore object dtype inference from iterable objects without `len()`
  • avoid gcc-4.1.2 (red hat 5) miscompilation causing a crash
  • fix nanmedian on arrays containing inf
  • copy inherited masks in MaskedArray.__array_finalize__
  • genfromtxt did not handle filling_values=0 correctly
  • restore api of npy_PyFile_DupClose in python2
  • cannot convert invalid sequence index to tuple
  • Segmentation fault with argmin() on unicode arrays
  • don't propagate subtypes from np.where
  • np.inner segfaults with SciPy's sparse matrices
  • Import dummy_threading if importing threading fails
  • Make numpy import when run with Python flag '-OO'
  • Einsum double contraction in particular order causes ValueError
  • Make f2py work with intent(in out)
  • Make python2 .npy files readable in python3
  • Use 'll' as the default length specifier for long long
  • fix build error with MSVC 2013 caused by C99 complex support
  • Make PyArray_PutTo respect writeable flag
  • fix crash when using arange on datetime without dtype set
  • fix build in c99 mode

New in Numpy (Numerical Python) 1.9.0 (Sep 8, 2014)

  • Highlights:
  • Numerous performance improvements in various areas, most notably indexing and operations on small arrays are significantly faster. Indexing operations now also release the GIL.
  • Addition of `nanmedian` and `nanpercentile` rounds out the nanfunction set.
  • Dropped Support:
  • The oldnumeric and numarray modules have been removed.
  • The doc/pyrex and doc/cython directories have been removed.
  • The doc/numpybook directory has been removed.
  • The numpy/testing/numpytest.py file has been removed together with the importall function it contained.

New in Numpy (Numerical Python) 1.8.2 (Aug 11, 2014)

  • Includes changes from the previous RC version

New in Numpy (Numerical Python) 1.8.2 RC 1 (Aug 6, 2014)

  • gh-4836: partition produces wrong results for multiple selections in equal ranges
  • gh-4656: Make fftpack._raw_fft threadsafe
  • gh-4628: incorrect argument order to _copyto in in np.nanmax, np.nanmin
  • gh-4613: Fix lack of NULL check in array_richcompare
  • gh-4642: Hold GIL for converting dtypes types with fields
  • gh-4733: fix np.linalg.svd(b, compute_uv=False)
  • gh-4853: avoid unaligned simd load on reductions on i386
  • gh-4774: avoid unaligned access for strided byteswap
  • gh-650: Prevent division by zero when creating arrays from some buffers
  • gh-4602: ifort has issues with optimization flag O2, use O1

New in Numpy (Numerical Python) 1.9.0 Beta (Jun 9, 2014)

  • Highlights:
  • Addition of `__numpy_ufunc__` to allow overriding ufuncs in ndarray subclasses.
  • Numerous performance improvements in various areas, most notably indexing and operations on small arrays are significantly faster. Indexing operations now also release the GIL.
  • Addition of `nanmedian` and `nanpercentile` rounds out the nanfunction set
  • Dropped Support:
  • The oldnumeric and numarray modules have been removed.
  • The doc/pyrex and doc/cython directories have been removed.
  • The doc/numpybook directory has been removed.
  • The numpy/testing/numpytest.py file has been removed together with the importall function it contained.
  • Future Changes:
  • The numpy/polynomial/polytemplate.py file will be removed in NumPy 1.10.0.
  • Default casting for inplace operations will change to 'same_kind' inNumpy 1.10.0. This will certainly break some code that is currently ignoring the warning.
  • Relaxed stride checking will be the default in 1.10.0
  • String version checks will break because, e.g., '1.9' > '1.10' is True. A NumpyVersion class has been added that can be used for such comparisons.
  • The diagonal and diag functions will return writeable views in 1.10.0
  • Compatibility notes:
  • The diagonal and diag functions return readonly views:
  • In NumPy 1.8, the diagonal and diag functions returned readonly copies, in
  • NumPy 1.9 they return readonly views, and in 1.10 they will return writeable
  • views.
  • Special scalar float values don't cause upcast to double anymore:
  • In previous numpy versions operations involving floating point scalars
  • containing special values ``NaN``, ``Inf`` and ``-Inf`` caused the result
  • type to be at least ``float64``. As the special values can be represented
  • in the smallest available floating point type, the upcast is not performed
  • anymore.
  • Percentile output changes:
  • If given more than one percentile to compute numpy.percentile returns an
  • array instead of a list. A single percentile still returns a scalar. The
  • array is equivalent to converting the list returned in older versions
  • to an array via ``np.array``.
  • If the ``overwrite_input`` option is used the input is only partially
  • instead of fully sorted.
  • ndarray.tofile exception type:
  • All ``tofile`` exceptions are now ``IOError``, some were previously
  • ``ValueError``.
  • Invalid fill value exceptions:
  • Two changes to numpy.ma.core._check_fill_value:
  • When the fill value is a string and the array type is not one of 'OSUV', TypeError is raised instead of the default fill value being used.
  • When the fill value overflows the array type, TypeError is raised instead of OverflowError.
  • Polynomial Classes no longer derived from PolyBase:
  • This may cause problems with folks who depended on the polynomial classes
  • being derived from PolyBase. They are now all derived from the abstract
  • base class ABCPolyBase. Strictly speaking, there should be a deprecation
  • involved, but no external code making use of the old baseclass could be
  • found.
  • Using numpy.random.binomial may change the RNG state vs. numpy < 1.9:
  • A bug in one of the algorithms to generate a binomial random variate has
  • been fixed. This change will likely alter the number of random draws
  • performed, and hence the sequence location will be different after a
  • call to distribution.c::rk_binomial_btpe. Any tests which rely on the RNG
  • being in a known state should be checked and/or updated as a result.
  • Random seed enforced to be a 32 bit unsigned integer:
  • ``np.random.seed`` and ``np.random.RandomState`` now throw a ``ValueError`` if the seed cannot safely be converted to 32 bit unsigned integers. Applications that now fail can be fixed by masking the higher 32 bit values to zero: ``seed = seed & 0xFFFFFFFF``. This is what is done silently in older versions so the random stream remains the same.
  • Argmin and argmax out argument:
  • The ``out`` argument to ``np.argmin`` and ``np.argmax`` and their
  • equivalent C-API functions is now checked to match the desired output shape
  • exactly. If the check fails a ``ValueError`` instead of ``TypeError`` is
  • raised.
  • Einsum:
  • Remove unnecessary broadcasting notation restrictions.
  • ``np.einsum('ijk,j->ijk', A, B)`` can also be written as
  • ``np.einsum('ij...,j->ij...', A, B)`` (ellipsis is no longer required on 'j')
  • Indexing:
  • The NumPy indexing has seen a complete rewrite in this version. This makes
  • most advanced integer indexing operations much faster and should have no
  • other implications. However some subtle changes and deprecations were
  • introduced in advanced indexing operations:
  • Boolean indexing into scalar arrays will always return a new 1-d array. This means that ``array(1)[array(True)]`` gives ``array([1])`` and not the original array.
  • Advanced indexing into one dimensional arrays used to have (undocumented) special handling regarding repeating the value array in assignments when the shape of the value array was too small or did not match. Code using this will raise an error. For compatibility you can use ``arr.flat[index] = values``, which uses the old code branch. (for example ``a = np.ones(10); a[np.arange(10)] = [1, 2, 3]``)
  • The iteration order over advanced indexes used to be always C-order. In NumPy 1.9. the iteration order adapts to the inputs and is not guaranteed (with the exception of a *single* advanced index which is never reversed for compatibility reasons). This means that the result is undefined if multiple values are assigned to the same element. An example for this is ``arr[[0, 0], [1, 1]] = [1, 2]``, which may set ``arr[0, 1]`` to either 1 or 2.
  • Equivalent to the iteration order, the memory layout of the advanced indexing result is adapted for faster indexing and cannot be predicted.
  • All indexing operations return a view or a copy. No indexing operation will return the original array object. (For example ``arr[...]``)
  • In the future Boolean array-likes (such as lists of python bools) will always be treated as Boolean indexes and Boolean scalars (including python ``True``) will be a legal *boolean* index. At this time, this is already the case for scalar arrays to allow the general ``positive = a[a > 0]`` to work when ``a`` is zero dimensional.
  • In NumPy 1.8 it was possible to use ``array(True)`` and ``array(False)`` equivalent to 1 and 0 if the result of the operation was a scalar. This will raise an error in NumPy 1.9 and, as noted above, treated as a boolean index in the future.
  • All non-integer array-likes are deprecated, object arrays of custom integer like objects may have to be cast explicitly.
  • The error reporting for advanced indexing is more informative, however the error type has changed in some cases. (Broadcasting errors of indexing arrays are reported as ``IndexError``)
  • Indexing with more then one ellipsis (``...``) is deprecated.
  • ``promote_types`` and string dtype:
  • ``promote_types`` function now returns a valid string length when given an
  • integer or float dtype as one argument and a string dtype as another
  • argument. Previously it always returned the input string dtype, even if it
  • wasn't long enough to store the max integer/float value converted to a
  • string.
  • `npyio.recfromcsv` keyword arguments change:
  • `npyio.recfromcsv` no longer accepts the undocumented `update` keyword,
  • which used to override the `dtype` keyword.
  • The ``doc/swig`` directory moved:
  • The ``doc/swig`` directory has been moved to ``tools/swig``.
  • The ``npy_3kcompat.h`` header changed:
  • The unused ``simple_capsule_dtor`` function has been removed from
  • ``npy_3kcompat.h``. Note that this header is not meant to be used outside
  • of numpy; other projects should be using their own copy of this file when
  • needed.
  • Negative indices in C-Api ``sq_item`` and ``sq_ass_item`` sequence methods:
  • When directly accessing the ``sq_item`` or ``sq_ass_item`` PyObject slots
  • for item getting, negative indices will not be supported anymore.
  • ``PySequence_GetItem`` and ``PySequence_SetItem`` however fix negative
  • indices so that they can be used there.
  • NDIter:
  • When ``NpyIter_RemoveAxis`` is now called, the iterator range will be reset.
  • When a multi index is being tracked and an iterator is not buffered, it is
  • possible to use ``NpyIter_RemoveAxis``. In this case an iterator can shrink
  • in size. Because the total size of an iterator is limited, the iterator
  • may be too large before these calls. In this case its size will be set to ``-1``
  • and an error issued not at construction time but when removing the multi
  • index, setting the iterator range, or getting the next function.
  • This has no effect on currently working code, but highlights the necessity
  • of checking for an error return if these conditions can occur. In most
  • cases the arrays being iterated are as large as the iterator so that such
  • a problem cannot occur.
  • This change was already applied to the 1.8.1 release.
  • New Features:
  • Percentile supports more interpolation options:
  • ``np.percentile`` now has the interpolation keyword argument to specify in
  • which way points should be interpolated if the percentiles fall between two
  • values. See the documentation for the available options.
  • Generalized axis support for median and percentile:
  • ``np.median`` and ``np.percentile`` now support generalized axis arguments like ufunc reductions do since 1.7. One can now say axis=(index, index) to pick a list of axes for the reduction. The ``keepdims`` keyword argument was also added to allow convenient broadcasting to arrays of the original shape.
  • Ufunc and Dot Overrides:
  • For better compatibility with external objects you can now override universal functions (ufuncs), ``numpy.core._dotblas.dot``, and ``numpy.core.multiarray.dot`` (the numpy.dot functions). By defining a ``__numpy_ufunc__`` method.
  • Dtype parameter added to ``np.linspace`` and ``np.logspace``:
  • The returned data type from the ``linspace`` and ``logspace`` functions can
  • now be specified using the dtype parameter.
  • More general ``np.triu`` and ``np.tril`` broadcasting:
  • For arrays with ``ndim`` exceeding 2, these functions will now apply to the
  • final two axes instead of raising an exception.
  • ``tobytes`` alias for ``tostring`` method:
  • ``ndarray.tobytes`` and ``MaskedArray.tobytes`` have been added as aliases for ``tostring`` which exports arrays as ``bytes``. This is more consistent in Python 3 where ``str`` and ``bytes`` are not the same.
  • Build system:
  • Added experimental support for the ppc64le and OpenRISC architecture.
  • Compatibility to python ``numbers`` module:
  • All numerical numpy types are now registered with the type hierarchy in the python ``numbers`` module.
  • ``increasing`` parameter added to ``np.vander``:
  • The ordering of the columns of the Vandermonde matrix can be specified with this new boolean argument.
  • ``unique_counts`` parameter added to ``np.unique``:
  • The number of times each unique item comes up in the input can now be
  • obtained as an optional return value.
  • Support for median and percentile in nanfunctions:
  • The ``np.nanmedian`` and ``np.nanpercentile`` functions behave like
  • the median and percentile functions except that NaNs are ignored.
  • NumpyVersion class added:
  • The class may be imported from numpy.lib and can be used for version
  • comparison when the numpy version goes to 1.10.devel.
  • Allow saving arrays with large number of named columns:
  • The numpy storage format 1.0 only allowed the array header to have a total size of 65535 bytes. This can be exceeded by structured arrays with a large number of columns. A new format 2.0 has been added which extends the header size to 4 GiB. `np.save` will automatically save in 2.0 format if the data requires it, else it will always use the more compatible 1.0 format.
  • Full broadcasting support for ``np.cross``:
  • ``np.cross`` now properly broadcasts its two input arrays, even if they have different number of dimensions. In earlier versions this would result in either an error being raised, or wrong results computed.
  • Improvements:
  • Percentile implemented in terms of ``np.partition``:
  • ``np.percentile`` has been implemented in terms of ``np.partition`` which
  • only partially sorts the data via a selection algorithm. This improves the
  • time complexity from ``O(nlog(n))`` to ``O(n)``.
  • Performance improvement for ``np.array``:
  • The performance of converting lists containing arrays to arrays using ``np.array`` has been improved. It is now equivalent in speed to ``np.vstack(list)``.
  • Performance improvement for ``np.searchsorted``:
  • For the built-in numeric types, ``np.searchsorted`` no longer relies on the data type's ``compare`` function to perform the search, but is now implemented by type specific functions. Depending on the size of the inputs, this can result in performance improvements over 2x.
  • Optional reduced verbosity for np.distutils:
  • Set ``numpy.distutils.system_info.system_info.verbosity = 0`` and then calls to ``numpy.distutils.system_info.get_info('blas_opt')`` will not print anything on the output. This is mostly for other packages using numpy.distutils.
  • Covariance check in ``np.random.multivariate_normal``:
  • A ``RuntimeWarning`` warning is raised when the covariance matrix is not
  • positive-semidefinite.
  • Polynomial Classes no longer template based:
  • The polynomial classes have been refactored to use an abstract base class
  • rather than a template in order to implement a common interface. This makes importing the polynomial package faster as the classes do not need to be compiled on import.
  • More GIL releases:
  • Several more functions now release the Global Interpreter Lock allowing more
  • efficient parallization using the ``threading`` module. Most notably the GIL is now released for fancy indexing, ``np.where`` and the ``random`` module now uses a per-state lock instead of the GIL.
  • MaskedArray support for more complicated base classes:
  • Built-in assumptions that the baseclass behaved like a plain array are being
  • removed. In particalur, ``repr`` and ``str`` should now work more reliably.
  • Deprecations:
  • Non-integer scalars for sequence repetition:
  • Using non-integer numpy scalars to repeat python sequences is deprecated.
  • For example ``np.float_(2) * [1]`` will be an error in the future.
  • ``select`` input deprecations:
  • The integer and empty input to ``select`` is deprecated. In the future only
  • boolean arrays will be valid conditions and an empty ``condlist`` will be
  • considered an input error instead of returning the default.
  • ``rank`` function:
  • The ``rank`` function has been deprecated to avoid confusion with
  • ``numpy.linalg.matrix_rank``.
  • Object array equality comparisons:
  • In the future object array comparisons both `==` and `np.equal` will not
  • make use of identity checks anymore.

New in Numpy (Numerical Python) 1.8.1 (Mar 26, 2014)

  • Issues fixed:
  • gh-4276: Fix mean, var, std methods for object arrays
  • gh-4262: remove insecure mktemp usage
  • gh-2385: absolute(complex(inf)) raises invalid warning in python3
  • gh-4024: Sequence assignment doesn't raise exception on shape mismatch
  • gh-4027: Fix chunked reading of strings longer than BUFFERSIZE
  • gh-4109: Fix object scalar return type of 0-d array indices
  • gh-4018: fix missing check for memory allocation failure in ufuncs
  • gh-4156: high order linalg.norm discards imaginary elements of complex arrays
  • gh-4144: linalg: norm fails on longdouble, signed int
  • gh-4094: fix NaT handling in _strided_to_strided_string_to_datetime
  • gh-4051: fix uninitialized use in _strided_to_strided_string_to_datetime
  • gh-4093: Loading compressed .npz file fails under Python 2.6.6
  • gh-4138: segfault with non-native endian memoryview in python 3.4
  • gh-4123: Fix missing NULL check in lexsort
  • gh-4170: fix native-only long long check in memoryviews
  • gh-4187: Fix large file support on 32 bit
  • gh-4152: fromfile: ensure file handle positions are in sync in python3
  • gh-4176: clang compatibility: Typos in conversion_utils
  • gh-4223: Fetching a non-integer item caused array return
  • gh-4197: fix minor memory leak in memoryview failure case
  • gh-4206: fix build with single-threaded python
  • gh-4220: add versionadded:: 1.8.0 to ufunc.at docstring
  • gh-4267: improve handling of memory allocation failure
  • gh-4267: fix use of capi without gil in ufunc.at
  • gh-4261: Detect vendor versions of GNU Compilers
  • gh-4253: IRR was returning nan instead of valid negative answer
  • gh-4254: fix unnecessary byte order flag change for byte arrays
  • gh-3263: numpy.random.shuffle clobbers mask of a MaskedArray
  • gh-4270: np.random.shuffle not work with flexible dtypes
  • gh-3173: Segmentation fault when 'size' argument to random.multinomial
  • gh-2799: allow using unique with lists of complex
  • gh-3504: fix linspace truncation for integer array scalar
  • gh-4191: get_info('openblas') does not read libraries key
  • gh-3348: Access violation in _descriptor_from_pep3118_format
  • gh-3175: segmentation fault with numpy.array() from bytearray
  • gh-4266: histogramdd - wrong result for entries very close to last boundary
  • gh-4408: Fix stride_stricks.as_strided function for object arrays
  • gh-4225: fix log1p and exmp1 return for np.inf on windows compiler builds
  • gh-4359: Fix infinite recursion in str.format of flex arrays
  • gh-4145: Incorrect shape of broadcast result with the exponent operator
  • gh-4483: Fix commutativity of {dot,multiply,inner}(scalar, matrix_of_objs)
  • gh-4466: Delay npyiter size check when size may change
  • gh-4485: Buffered stride was erroneously marked fixed
  • gh-4354: byte_bounds fails with datetime dtypes
  • gh-4486: segfault/error converting from/to high-precision datetime64 objects
  • gh-4428: einsum(None, None, None, None) causes segfault
  • gh-4134: uninitialized use for for size 1 object reductions
  • Changes:
  • NDIter:
  • When ``NpyIter_RemoveAxis`` is now called, the iterator range will be reset.
  • When a multi index is being tracked and an iterator is not buffered, it is possible to use ``NpyIter_RemoveAxis``. In this case an iterator can shrink in size. Because the total size of an iterator is limited, the iterator may be too large before these calls. In this case its size will be set to ``-1`` and an error issued not at construction time but when removing the multi index, setting the iterator range, or getting the next function.
  • This has no effect on currently working code, but highlights the necessity of checking for an error return if these conditions can occur. In most cases the arrays being iterated are as large as the iterator so that such a problem cannot occur.
  • Optional reduced verbosity for np.distutils:
  • Set ``numpy.distutils.system_info.system_info.verbosity = 0`` and then calls to ``numpy.distutils.system_info.get_info('blas_opt')`` will not print anything on the output. This is mostly for other packages using numpy.distutils.
  • Deprecations:
  • C-API - The utility function npy_PyFile_Dup and npy_PyFile_DupClose are broken by the internal buffering python 3 applies to its file objects. To fix this two new functions npy_PyFile_Dup2 and npy_PyFile_DupClose2 are declared in npy_3kcompat.h and the old functions are deprecated. Due to the fragile nature of these functions it is recommended to instead use the python API when possible.

New in Numpy (Numerical Python) 1.8.0 (Feb 28, 2014)

  • This release supports Python 2.6 -2.7 and 3.2 - 3.3.
  • New, no 2to3, Python 2 and Python 3 are supported by a common code base.
  • New, gufuncs for linear algebra, enabling operations on stacked arrays.
  • New, inplace fancy indexing for ufuncs with the ``.at`` method.
  • New, ``partition`` function, partial sorting via selection for fast median.
  • New, ``nanmean``, ``nanvar``, and ``nanstd`` functions skipping NaNs.
  • New, ``full`` and ``full_like`` functions to create value initialized arrays.
  • New, ``PyUFunc_RegisterLoopForDescr``, better ufunc support for user dtypes. Numerous performance improvements in many areas.

New in Numpy (Numerical Python) 1.8.0 RC 2 (Oct 15, 2013)

  • New Features:
  • Support for linear algebra on stacked arrays
  • The gufunc machinery is now used for np.linalg, allowing operations on stacked arrays and vectors.
  • In place fancy indexing for ufuncs:
  • The function ``at`` has been added to ufunc objects to allow in place ufuncs with no buffering when fancy indexing is used. For example, the following will increment the first and second items in the array, and will increment the third item twice: ``numpy.add.at(arr, [0, 1, 2, 2], 1)`` This is what many have mistakenly thought ``arr[[0, 1, 2, 2]] += 1`` would do, but that does not work as the incremented value of ``arr[2]`` is simply copied into the third slot in ``arr`` twice, not incremented twice.
  • New functions `partition` and `argpartition`:
  • New functions to partially sort arrays via a selection algorithm. A ``partition`` by index ``k`` moves the ``k`` smallest element to the front of an array. All elements before ``k`` are then smaller or equal than the value in position ``k`` and all elements following ``k`` are then greater or equal than the value in position ``k``. The ordering of the values within these bounds is undefined. A sequence of indices can be provided to sort all of them into their sorted position at once iterative partitioning. This can be used to efficiently obtain order statistics like median or percentiles of samples. ``partition`` has a linear time complexity of ``O(n)`` while a full sort has ``O(n log(n))``.
  • New functions `nanmean`, `nanvar` and `nanstd`:
  • New nan aware statistical functions are added. In these functions the results are what would be obtained if nan values were ommited from all computations.
  • New functions `full` and `full_like`:
  • New convenience functions to create arrays filled with a specific value; complementary to the existing `zeros` and `zeros_like` functions.
  • IO compatibility with large files
  • Large NPZ files >2GB can be loaded on 64-bit systems.
  • Building against OpenBLAS:
  • It is now possible to build numpy against OpenBLAS by editing site.cfg.
  • New constant:
  • Euler's constant is now exposed in numpy as euler_gamma.
  • New modes for qr:
  • New modes 'complete', 'reduced', and 'raw' have been added to the qr factorization and the old 'full' and 'economic' modes are deprecated. The 'reduced' mode replaces the old 'full' mode and is the default as was the 'full' mode, so backward compatibility can be maintained by not specifying the mode. The 'complete' mode returns a full dimensional factorization, which can be useful for obtaining a basis for the orthogonal complement of the range space. The 'raw' mode returns arrays that contain the Householder reflectors and scaling factors that can be used in the future to apply q without needing to convert to a matrix. The 'economic' mode is simply deprecated, there isn't much use for it and it isn't any more efficient than the 'raw' mode.
  • New `invert` argument to `in1d`:
  • The function `in1d` now accepts a `invert` argument which, when `True`, causes the returned array to be inverted.
  • Advanced indexing using `np.newaxis`:
  • It is now possible to use `np.newaxis`/`None` together with index arrays instead of only in simple indices. This means that ``array[np.newaxis, [0, 1]]`` will now work as expected and select the first two rows while prepending a new axis to the array.
  • C-API:
  • New ufuncs can now be registered with builtin input types and a custom output type. Before this change, NumPy wouldn't be able to find the right ufunc loop function when the ufunc was called from Python, because the ufunc loop signature matching logic wasn't looking at the output operand type. Now the correct ufunc loop is found, as long as the user provides an output argument with the correct output type. runtests.py
  • A simple test runner script ``runtests.py`` was added. It also builds Numpy via ``setup.py build`` and can be used to run tests easily during development.
  • Improvements:
  • IO performance improvements:
  • Performance in reading large files was improved by chunking (see also IO compatibility).
  • Performance improvements to `pad`:
  • The `pad` function has a new implementation, greatly improving performance for all inputs except `mode=` (retained for backwards compatibility). Scaling with dimensionality is dramatically improved for rank >= 4. Performance improvements to `isnan`, `isinf`, `isfinite` and `byteswap`
  • `isnan`, `isinf`, `isfinite` and `byteswap` have been improved to take advantage of compiler builtins to avoid expensive calls to libc. This improves performance of these operations by about a factor of two on gnu libc systems.
  • Performance improvements via SSE2 vectorization:
  • Several functions have been optimized to make use of SSE2 CPU SIMD instructions. * Float32 and float64: * base math (`add`, `subtract`, `divide`, `multiply`) * `sqrt` * `minimum/maximum` * `absolute` * Bool: * `logical_or` * `logical_and` * `logical_not` This improves performance of these operations up to 4x/2x for float32/float64 and up to 10x for bool depending on the location of the data in the CPU caches. The performance gain is greatest for in-place operations. In order to use the improved functions the SSE2 instruction set must be enabled at compile time. It is enabled by default on x86_64 systems. On x86_32 with a capable CPU it must be enabled by passing the appropriate flag to the CFLAGS build variable (-msse2 with gcc).
  • Performance improvements to `median`:
  • `median` is now implemented in terms of `partition` instead of `sort` which reduces its time complexity from O(n log(n)) to O(n). If used with the `overwrite_input` option the array will now only be partially sorted instead of fully sorted.
  • Overrideable operand flags in ufunc C-API:
  • When creating a ufunc, the default ufunc operand flags can be overridden via the new op_flags attribute of the ufunc object. For example, to set the operand flag for the first input to read/write: PyObject \*ufunc = PyUFunc_FromFuncAndData(...); ufunc->op_flags[0] = NPY_ITER_READWRITE; This allows a ufunc to perform an operation in place. Also, global nditer flags can be overridden via the new iter_flags attribute of the ufunc object. For example, to set the reduce flag for a ufunc: ufunc->iter_flags = NPY_ITER_REDUCE_OK;
  • Changes:
  • General:
  • The function np.take now allows 0-d arrays as indices. The separate compilation mode is now enabled by default. Several changes to np.insert and np.delete: * Previously, negative indices and indices that pointed past the end of the array were simply ignored. Now, this will raise a Future or Deprecation Warning. In the future they will be treated like normal indexing treats them -- negative indices will wrap around, and out-of-bound indices will generate an error. * Previously, boolean indices were treated as if they were integers (always referring to either the 0th or 1st item in the array). In the future, they will be treated as masks. In this release, they raise a FutureWarning warning of this coming change. * In Numpy 1.7. np.insert already allowed the syntax `np.insert(arr, 3, [1,2,3])` to insert multiple items at a single position. In Numpy 1.8. this is also possible for `np.insert(arr, [3], [1, 2, 3])`. Padded regions from np.pad are now correctly rounded, not truncated. C-API Array
  • Additions:
  • Four new functions have been added to the array C-API.
  • PyArray_Partition
  • PyArray_ArgPartition
  • PyArray_SelectkindConverter
  • PyDataMem_NEW_ZEROED C-API Ufunc
  • Additions:
  • One new function has been added to the ufunc C-API that allows to register an inner loop for user types using the descr.
  • PyUFunc_RegisterLoopForDescr

New in Numpy (Numerical Python) 1.8.0 RC 1 (Sep 30, 2013)

  • Dropped Support:
  • Support for Python versions 2.4 and 2.5 has been dropped, Support for SCons has been removed.
  • New Features:
  • Building against OpenBLAS
  • It is now possible to build numpy against OpenBLAS by editing site.cfg.
  • New constant
  • Euler's constant is now exposed in numpy as euler_gamma.
  • New modes for qr
  • New modes 'complete', 'reduced', and 'raw' have been added to the qr factorization and the old 'full' and 'economic' modes are deprecated. The 'reduced' mode replaces the old 'full' mode and is the default as was the 'full' mode, so backward compatibility can be maintained by not specifying the mode.
  • The 'complete' mode returns a full dimensional factorization, which can be useful for obtaining a basis for the orthogonal complement of the range space. The 'raw' mode returns arrays that contain the Householder reflectors and scaling factors that can be used in the future to apply q without needing to convert to a matrix. The 'economic' mode is simply deprecated, there isn't much use for it and it isn't any more efficient than the 'raw' mode.
  • New `invert` argument to `in1d`
  • The function `in1d` now accepts a `invert` argument which, when `True`, causes the returned array to be inverted.
  • Advanced indexing using `np.newaxis`
  • It is now possible to use `np.newaxis`/`None` together with index arrays instead of only in simple indices. This means that array[np.newaxis, [0, 1]]`` will now work as expected.
  • New functions `full` and `full_like`
  • New convenience functions to create arrays filled with a specific value; complementary to the existing `zeros` and `zeros_like` functions.
  • New functions `partition` and `argpartition`
  • New functions to partially sort arrays.
  • Partial sorting moves the value of selected elements into their position if the array would be sorted via a selection algorithm. In the resulting array all elements smaller than the sorted elements will placed before the it and all equal or larger behind it.
  • This has a time complexity of O(n) compared to O(n log(n)) of a full sort.
  • New functions `nanmean`, `nanvar` and `nanstd`:
  • New nan aware statistical functions are added. In these functions the results are what would be obtained if nan values were ommited from all computations.
  • In place fancy indexing for ufuncs
  • The function ``at`` has been added to ufunc objects to allow in place
  • ufuncs with no buffering when fancy indexing is used. For example, the
  • following will increment the first and second items in the array, and will
  • increment the third item twice:
  • numpy.add.at(array, [0, 1, 2, 2], 1)
  • This is similar to doing array[[0, 1, 2, 2]] += 1
  • C-API:
  • New ufuncs can now be registered with built in input types and a custom output type. Before this change, NumPy wouldn't be able to find the right ufunc loop function when the ufunc was called from Python, because the ufunc loop signature matching logic wasn't looking at the output operand type. Now the correct ufunc loop is found, as long as the user provides an output argument with the correct output type.
  • runtests.py:
  • A simple test runner script ``runtests.py`` was added. It also builds Numpy via setup.py build`` and can be used to run tests easily during development.
  • Improvements:
  • IO performance improvements:
  • Performance in reading large files was improved by chunking (see also IO compatibility).
  • Performance improvements to `pad`:
  • The `pad` function has a new implementation, greatly improving performance for
  • all inputs except `mode=` (retained for backwards compatibility).
  • Scaling with dimensionality is dramatically improved for rank >= 4.
  • Performance improvements to `isnan`, `isinf`, `isfinite` and `byteswap`:
  • isnan`, `isinf`, `isfinite` and `byteswap` have been improved to take advantage of compiler builtins to avoid expensive calls to libc.
  • This improves performance of these operations by about a factor of two on gnu libc systems.
  • Performance improvements via SSE2 vectorization
  • Several functions have been optimized to make use of SSE2 CPU SIMD instructions.
  • Float32 and float64:
  • base math (`add`, `subtract`, `divide`, `multiply`) sqrt`
  • minimum/maximum`
  • absolute`
  • Bool:
  • logical_or`
  • logical_and`
  • logical_not`
  • This improves performance of these operations up to 4x/2x for float32/float64 and up to 10x for bool depending on the location of the data in the CPU caches.
  • The performance gain is greatest for in-place operations.
  • In order to use the improved functions the SSE2 instruction set must be enabled at compile time. It is enabled by default on x86_64 systems. On x86_32 with a capable CPU it must be enabled by passing the appropriate flag to the CFLAGS build variable (-msse2 with gcc).
  • Performance improvements to `median`:
  • median` is now implemented in terms of `partition` instead of `sort` which reduces its time complexity from O(n log(n)) to O(n). If used with the `overwrite_input` option the array will now only be partially sorted instead of fully sorted.
  • Changes:
  • General:
  • The function np.take now allows 0-d arrays as indices.
  • The separate compilation mode is now enabled by default.
  • Several changes to np.insert and np.delete:
  • Previously, negative indices and indices that pointed past the end of the array were simply ignored. Now, this will raise a Future or Deprecation
  • Warning. In the future they will be treated like normal indexing treats them -- negative indices will wrap around, and out-of-bound indices will generate an error.
  • Previously, boolean indices were treated as if they were integers (always referring to either the 0th or 1st item in the array). In the future, they will be treated as masks. In this release, they raise a FutureWarning warning of this coming change.
  • In Numpy 1.7. np.insert already allowed the syntax
  • np.insert(arr, 3, [1,2,3])` to insert multiple items at a single position.
  • In Numpy 1.8. this is also possible for `np.insert(arr, [3], [1, 2, 3])`.
  • Padded regions from np.pad are now correctly rounded, not truncated.
  • C-API Array Additions:
  • Three new functions have been added to the array C-API.
  • PyArray_Partition
  • PyArray_ArgPartition
  • PyArray_SelectkindConverter
  • PyDataMem_NEW_ZEROED
  • C-API Ufunc Additions:
  • One new function has been added to the ufunc C-API that allows to register an inner loop for user types using the descr. PyUFunc_RegisterLoopForDescr
  • Deprecations:
  • The 'full' and 'economic' modes of qr factorization are deprecated.
  • General:
  • The use of non-integer for indices and most integer arguments has been deprecated. Previously float indices and function arguments such as axes or shapes were truncated to integers without warning. For example arr.reshape(3., -1)` or `arr[0.]` will trigger a deprecation warning in NumPy 1.8., and in some future version of NumPy they will raise an error.
  • New Features:
  • When creating a ufunc, the default ufunc operand flags can be overridden via the new op_flags attribute of the ufunc object. For example, to set the operand flag for the first input to read/write:
  • PyObject \*ufunc = PyUFunc_FromFuncAndData(...); ufunc->op_flags[0] = NPY_ITER_READWRITE;
  • This allows a ufunc to perform an operation in place. Also, global nditer flags can be overridden via the new iter_flags attribute of the ufunc object.
  • For example, to set the reduce flag for a ufunc: ufunc->iter_flags = NPY_ITER_REDUCE_OK;

New in Numpy (Numerical Python) 1.7.1 (Apr 8, 2013)

  • Issues fixed:
  • gh-2973 Fix `1` is printed during numpy.test()
  • gh-2983 BUG: gh-2969: Backport memory leak fix 80b3a34.
  • gh-3007 Backport gh-3006
  • gh-2984 Backport fix complex polynomial fit
  • gh-2982 BUG: Make nansum work with booleans.
  • gh-2985 Backport large sort fixes
  • gh-3039 Backport object take
  • gh-3105 Backport nditer fix op axes initialization
  • gh-3108 BUG: npy-pkg-config ini files were missing after Bento build.
  • gh-3124 BUG: PyArray_LexSort allocates too much temporary memory.
  • gh-3131 BUG: Exported f2py_size symbol prevents linking multiple f2py modules.
  • gh-3117 Backport gh-2992
  • gh-3135 DOC: Add mention of PyArray_SetBaseObject stealing a reference gh-3134 DOC: Fix typo in fft docs (the indexing variable is 'm', not 'n'). gh-3136 Backport #3128

New in Numpy (Numerical Python) 1.7.1 RC 1 (Mar 25, 2013)

  • Issues Fixed:
  • gh-2973 Fix `1` is printed during numpy.test()
  • gh-2983 BUG: gh-2969: Backport memory leak fix
  • gh-3007 Backport
  • gh-3006
  • gh-2984 Backport fix complex polynomial fit
  • gh-2982 BUG: Make nansum work with booleans.
  • gh-2985 Backport large sort fixes
  • gh-3039 Backport object take
  • gh-3105 Backport nditer fix op axes initialization
  • gh-3108 BUG: npy-pkg-config ini files were missing after Bento build.
  • gh-3124 BUG: PyArray_LexSort allocates too much temporary memory.
  • gh-3131 BUG: Exported f2py_size symbol prevents linking multiple f2py modules.
  • gh-3117 Backport gh-2992
  • gh-3135 DOC: Add mention of PyArray_SetBaseObject stealing a reference
  • gh-3134 DOC: Fix typo in fft docs (the indexing variable is 'm', not 'n').
  • gh-3136 Backport #3128

New in Numpy (Numerical Python) 1.7.0 (Feb 11, 2013)

  • New Features:
  • Reduction UFuncs Generalize axis= Parameter:
  • Any ufunc.reduce function call, as well as other reductions like sum, prod, any, all, max and min support the ability to choose a subset of the axes to reduce over. Previously, one could say axis=None to mean all the axes or axis=# to pick a single axis. Now, one can also say axis=(#,#) to pick a list of axes for reduction.
  • Reduction UFuncs New keepdims= Parameter:
  • There is a new keepdims= parameter, which if set to True, doesn't throw away the reduction axes but instead sets them to have size one. When this option is set, the reduction result will broadcast correctly to the original operand which was reduced.
  • Datetime support:
  • .. note:: The datetime API is *experimental* in 1.7.0, and may undergo changes in future versions of NumPy.
  • There have been a lot of fixes and enhancements to datetime64 compared to NumPy 1.6:
  • the parser is quite strict about only accepting ISO 8601 dates, with a few convenience extensions
  • converts between units correctly
  • datetime arithmetic works correctly
  • business day functionality (allows the datetime to be used in contexts where only certain days of the week are valid)
  • Custom formatter for printing arrays:
  • See the new ``formatter`` parameter of the ``numpy.set_printoptions`` function.
  • New function numpy.random.choice:
  • A generic sampling function has been added which will generate samples from a given array-like. The samples can be with or without replacement, and with uniform or given non-uniform probabilities.
  • New function isclose:
  • Returns a boolean array where two arrays are element-wise equal within a tolerance. Both relative and absolute tolerance can be specified.
  • Preliminary multi-dimensional support in the polynomial package:
  • Axis keywords have been added to the integration and differentiation functions and a tensor keyword was added to the evaluation functions. These additions allow multi-dimensional coefficient arrays to be used in those functions. New functions for evaluating 2-D and 3-D coefficient arrays on grids or sets of points were added together with 2-D and 3-D pseudo-Vandermonde matrices that can be used for fitting.
  • Ability to pad rank-n arrays:A pad module containing functions for padding n-dimensional arrays has been added. The various private padding functions are exposed as options to a public 'pad' function.
  • Example:: pad(a, 5, mode='mean')
  • Current modes are ``constant``, ``edge``, ``linear_ramp``, ``maximum``, ``mean``, ``median``, ``minimum``, ``reflect``, ``symmetric``, ``wrap``, and ````
  • New argument to searchsorted:
  • The function searchsorted now accepts a 'sorter' argument that is a permutation array that sorts the array to search.
  • Build system:
  • Added experimental support for the AArch64 architecture.
  • C API:
  • New function ``PyArray_RequireWriteable`` provides a consistent interface for checking array writeability -- any C code which works with arrays whose WRITEABLE flag is not known to be True a priori, should make sure to call this function before writing. NumPy C Style Guide added
  • Changes:
  • General:
  • The function np.concatenate tries to match the layout of its input arrays. Previously, the layout did not follow any particular reason, and depended in an undesirable way on the particular axis chosen for concatenation. A bug was also fixed which silently allowed out of bounds axis arguments.
  • The ufuncs logical_or, logical_and, and logical_not now follow Python's behavior with object arrays, instead of trying to call methods on the objects. For example the expression (3 and 'test') produces the string 'test', and now np.logical_and(np.array(3, 'O'), np.array('test', 'O')) produces 'test' as well. The ``.base`` attribute on ndarrays, which is used on views to ensure that the underlying array owning the memory is not deallocated prematurely, now collapses out references when you have a view-of-a-view.
  • For example:: a = np.arange(10) b = a[1:] c = b[1:]
  • In numpy 1.6, ``c.base`` is ``b``, and ``c.base.base`` is ``a``. In numpy 1.7, ``c.base`` is ``a``.
  • To increase backwards compatibility for software which relies on the old behaviour of ``.base``, we only 'skip over' objects which have exactly the same type as the newly created view. This makes a difference if you use ``ndarray`` subclasses. For example, if we have a mix of ``ndarray`` and ``matrix`` objects which are all views on the same original ``ndarray``:: a = np.arange(10) b = np.asmatrix(a) c = b[0, 1:] d = c[0, 1:] then ``d.base`` will be ``b``. This is because ``d`` is a ``matrix`` object, and so the collapsing process only continues so long as it encounters other ``matrix`` objects. It considers ``c``, ``b``, and ``a`` in that order, and ``b`` is the last entry in that list which is a ``matrix`` object.
  • Casting Rules:
  • Casting rules have undergone some changes in corner cases, due to the NA-related work. In particular for combinations of scalar+scalar:
  • the `longlong` type (`q`) now stays `longlong` for operations with any other number (`? b h i l q p B H I`), previously it was cast as `int_` (`l`). The `ulonglong` type (`Q`) now stays as `ulonglong` instead of `uint` (`L`).
  • the `timedelta64` type (`m`) can now be mixed with any integer type (`b h i l q p B H I L Q P`), previously it raised `TypeError`.
  • For array + scalar, the above rules just broadcast except the case when the array and scalars are unsigned/signed integers, then the result gets converted to the array type (of possibly larger size) as illustrated by the following examples:: >>> (np.zeros((2,), dtype=np.uint8) + np.int16(257)).dtype dtype('uint16') >>> (np.zeros((2,), dtype=np.int8) + np.uint16(257)).dtype dtype('int16') >>> (np.zeros((2,), dtype=np.int16) + np.uint32(2**17)).dtype dtype('int32')
  • Whether the size gets increased depends on the size of the scalar, for example:: >>> (np.zeros((2,), dtype=np.uint8) + np.int16(255)).dtype dtype('uint8') >>> (np.zeros((2,), dtype=np.uint8) + np.int16(256)).dtype dtype('uint16')
  • Also a ``complex128`` scalar + ``float32`` array is cast to ``complex64``.
  • In NumPy 1.7 the `datetime64` type (`M`) must be constructed by explicitly specifying the type as the second argument (e.g. ``np.datetime64(2000, 'Y')``).
  • Deprecations:
  • General:
  • Specifying a custom string formatter with a `_format` array attribute is deprecated. The new `formatter` keyword in ``numpy.set_printoptions`` or ``numpy.array2string`` can be used instead.
  • The deprecated imports in the polynomial package have been removed.
  • ``concatenate`` now raises DepractionWarning for 1D arrays if ``axis != 0``. Versions of numpy < 1.7.0 ignored axis argument value for 1D arrays. We allow this for now, but in due course we will raise an error.
  • C-API:
  • Direct access to the fields of PyArrayObject* has been deprecated. Direct access has been recommended against for many releases. Expect similar deprecations for PyArray_Descr* and other core objects in the future as preparation for NumPy 2.0.
  • The macros in old_defines.h are deprecated and will be removed in the next major release (>= 2.0). The sed script tools/replace_old_macros.sed can be used to replace these macros with the newer versions.
  • You can test your code against the deprecated C API by #defining NPY_NO_DEPRECATED_API to the target version number, for example NPY_1_7_API_VERSION, before including any NumPy headers.

New in Numpy (Numerical Python) 1.7.0 RC 2 (Feb 7, 2013)

  • New features:
  • Reduction UFuncs Generalize axis= Parameter:
  • Any ufunc.reduce function call, as well as other reductions like sum, prod, any, all, max and min support the ability to choose a subset of the axes to reduce over. Previously, one could say axis=None to mean all the axes or axis=# to pick a single axis. Now, one can also say axis=(#,#) to pick a list of axes for reduction.
  • Reduction UFuncs New keepdims= Parameter:
  • There is a new keepdims= parameter, which if set to True, doesn't throw away the reduction axes but instead sets them to have size one. When this option is set, the reduction result will broadcast correctly to the original operand which was reduced.
  • Datetime support:
  • .. note:: The datetime API is *experimental* in 1.7.0, and may undergo changes in future versions of NumPy.
  • There have been a lot of fixes and enhancements to datetime64 compared to NumPy 1.6:
  • the parser is quite strict about only accepting ISO 8601 dates, with a few convenience extensions
  • converts between units correctly
  • datetime arithmetic works correctly
  • business day functionality (allows the datetime to be used in contexts where only certain days of the week are valid)
  • Custom formatter for printing arrays:
  • See the new ``formatter`` parameter of the ``numpy.set_printoptions`` function.
  • New function numpy.random.choice:
  • A generic sampling function has been added which will generate samples from a given array-like. The samples can be with or without replacement, and with uniform or given non-uniform probabilities.
  • New function isclose:
  • Returns a boolean array where two arrays are element-wise equal within a tolerance. Both relative and absolute tolerance can be specified.
  • Preliminary multi-dimensional support in the polynomial package:
  • Axis keywords have been added to the integration and differentiation functions and a tensor keyword was added to the evaluation functions. These additions allow multi-dimensional coefficient arrays to be used in those functions. New functions for evaluating 2-D and 3-D coefficient arrays on grids or sets of points were added together with 2-D and 3-D pseudo-Vandermonde matrices that can be used for fitting.
  • Ability to pad rank-n arrays:A pad module containing functions for padding n-dimensional arrays has been added. The various private padding functions are exposed as options to a public 'pad' function. Example:: pad(a, 5, mode='mean')
  • Current modes are ``constant``, ``edge``, ``linear_ramp``, ``maximum``, ``mean``, ``median``, ``minimum``, ``reflect``, ``symmetric``, ``wrap``, and ````.
  • New argument to searchsorted:
  • The function searchsorted now accepts a 'sorter' argument that is a permutation array that sorts the array to search.
  • Build system:
  • Added experimental support for the AArch64 architecture.
  • C API:
  • New function ``PyArray_RequireWriteable`` provides a consistent interface for checking array writeability -- any C code which works with arrays whose WRITEABLE flag is not known to be True a priori, should make sure to call this function before writing. NumPy C Style Guide added (``doc/C_STYLE_GUIDE.rst.txt``).
  • Changes:
  • General
  • The function np.concatenate tries to match the layout of its input arrays. Previously, the layout did not follow any particular reason, and depended in an undesirable way on the particular axis chosen for concatenation. A bug was also fixed which silently allowed out of bounds axis arguments.
  • The ufuncs logical_or, logical_and, and logical_not now follow Python's behavior with object arrays, instead of trying to call methods on the objects. For example the expression (3 and 'test') produces the string 'test', and now np.logical_and(np.array(3, 'O'), np.array('test', 'O')) produces 'test' as well.
  • The ``.base`` attribute on ndarrays, which is used on views to ensure that the underlying array owning the memory is not deallocated prematurely, now collapses out references when you have a view-of-a-view. For example:: a = np.arange(10) b = a[1:] c = b[1:] In numpy 1.6, ``c.base`` is ``b``, and ``c.base.base`` is ``a``.
  • In numpy 1.7, ``c.base`` is ``a``.
  • To increase backwards compatibility for software which relies on the old behavior of ``.base``, we only 'skip over' objects which have exactly the same type as the newly created view. This makes a difference if you use ``ndarray`` subclasses. For example, if we have a mix of ``ndarray`` and ``matrix`` objects which are all views on the same original ``ndarray``:: a = np.arange(10) b = np.asmatrix(a) c = b[0, 1:] d = c[0, 1:] then ``d.base`` will be ``b``. This is because ``d`` is a ``matrix`` object, and so the collapsing process only continues so long as it encounters other ``matrix`` objects. It considers ``c``, ``b``, and ``a`` in that order, and ``b`` is the last entry in that list which is a ``matrix`` object.
  • Casting Rules:
  • Casting rules have undergone some changes in corner cases, due to the NA-related work. In particular for combinations of scalar+scalar:
  • the `longlong` type (`q`) now stays `longlong` for operations with any other number (`? b h i l q p B H I`), previously it was cast as `int_` (`l`). The `ulonglong` type (`Q`) now stays as `ulonglong` instead of `uint` (`L`).
  • the `timedelta64` type (`m`) can now be mixed with any integer type (`b h i l q p B H I L Q P`), previously it raised `TypeError`.
  • For array + scalar, the above rules just broadcast except the case when the array and scalars are unsigned/signed integers, then the result gets converted to the array type (of possibly larger size) as illustrated by the following examples:: >>> (np.zeros((2,), dtype=np.uint8) + np.int16(257)).dtype dtype('uint16') >>> (np.zeros((2,), dtype=np.int8) + np.uint16(257)).dtype dtype('int16') >>> (np.zeros((2,), dtype=np.int16) + np.uint32(2**17)).dtype dtype('int32')
  • Whether the size gets increased depends on the size of the scalar, for example:: >>> (np.zeros((2,), dtype=np.uint8) + np.int16(255)).dtype dtype('uint8') >>> (np.zeros((2,), dtype=np.uint8) + np.int16(256)).dtype dtype('uint16')
  • Also a ``complex128`` scalar + ``float32`` array is cast to ``complex64``.
  • In NumPy 1.7 the `datetime64` type (`M`) must be constructed by explicitly specifying the type as the second argument (e.g. ``np.datetime64(2000, 'Y')``).
  • Deprecations:
  • General:
  • Specifying a custom string formatter with a `_format` array attribute is deprecated. The new `formatter` keyword in ``numpy.set_printoptions`` or ``numpy.array2string`` can be used instead.
  • The deprecated imports in the polynomial package have been removed.
  • ``concatenate`` now raises DepractionWarning for 1D arrays if ``axis != 0``. Versions of numpy < 1.7.0 ignored axis argument value for 1D arrays. We allow this for now, but in due course we will raise an error.
  • C-API:
  • Direct access to the fields of PyArrayObject* has been deprecated. Direct access has been recommended against for many releases. Expect similar deprecations for PyArray_Descr* and other core objects in the future as preparation for NumPy 2.0.
  • The macros in old_defines.h are deprecated and will be removed in the next major release (>= 2.0). The sed script tools/replace_old_macros.sed can be used to replace these macros with the newer versions.
  • You can test your code against the deprecated C API by #defining NPY_NO_DEPRECATED_API to the target version number, for example NPY_1_7_API_VERSION, before including any NumPy headers.
  • The ``NPY_CHAR`` member of the ``NPY_TYPES`` enum is deprecated and will be removed in NumPy 1.8. See the discussion at `gh-2801 `_ for more details.

New in Numpy (Numerical Python) 1.7.0 RC 1 (Dec 29, 2012)

  • New features:
  • Reduction UFuncs Generalize axis= Parameter
  • Any ufunc.reduce function call, as well as other reductions like sum, prod, any, all, max and min support the ability to choose a subset of the axes to reduce over. Previously, one could say axis=None to mean all the axes or axis=# to pick a single axis. Now, one can also say axis=(#,#) to pick a list of axes for reduction. Reduction UFuncs New keepdims= Parameter
  • There is a new keepdims= parameter, which if set to True, doesn't throw away the reduction axes but instead sets them to have size one. When this option is set, the reduction result will broadcast correctly to the original operand which was reduced.
  • Datetime support
  • .. note:: The datetime API is *experimental* in 1.7.0, and may undergo changes in future versions of NumPy. There have been a lot of fixes and enhancements to datetime64 compared to NumPy 1.6: * the parser is quite strict about only accepting ISO 8601 dates, with a few convenience extensions * converts between units correctly * datetime arithmetic works correctly * business day functionality (allows the datetime to be used in contexts where only certain days of the week are valid) The notes in `doc/source/reference/arrays.datetime.rst `_ (also available in the online docs at `arrays.datetime.html `_) should be consulted for more details.
  • Custom formatter for printing arrays
  • See the new ``formatter`` parameter of the ``numpy.set_printoptions`` function.
  • New function numpy.random.choice
  • A generic sampling function has been added which will generate samples from a given array-like. The samples can be with or without replacement, and with uniform or given non-uniform probabilities.
  • New function isclose
  • Returns a boolean array where two arrays are element-wise equal within a tolerance. Both relative and absolute tolerance can be specified.
  • Preliminary multi-dimensional support in the polynomial package
  • Axis keywords have been added to the integration and differentiation functions and a tensor keyword was added to the evaluation functions. These additions allow multi-dimensional coefficient arrays to be used in those functions. New functions for evaluating 2-D and 3-D coefficient arrays on grids or sets of points were added together with 2-D and 3-D pseudo-Vandermonde matrices that can be used for fitting.
  • Ability to pad rank-n arrays
  • A pad module containing functions for padding n-dimensional arrays has been added. The various private padding functions are exposed as options to a public 'pad' function. Example:: pad(a, 5, mode='mean') Current modes are ``constant``, ``edge``, ``linear_ramp``, ``maximum``, ``mean``, ``median``, ``minimum``, ``reflect``, ``symmetric``, ``wrap``, and ````.
  • New argument to searchsorted
  • The function searchsorted now accepts a 'sorter' argument that is a permutation array that sorts the array to search. C API ----- New function ``PyArray_RequireWriteable`` provides a consistent interface for checking array writeability -- any C code which works with arrays whose WRITEABLE flag is not known to be True a priori, should make sure to call this function before writing. NumPy C Style Guide added (``doc/C_STYLE_GUIDE.rst.txt``).
  • Changes
  • General
  • The function np.concatenate tries to match the layout of its input arrays. Previously, the layout did not follow any particular reason, and depended in an undesirable way on the particular axis chosen for concatenation. A bug was also fixed which silently allowed out of bounds axis arguments. The ufuncs logical_or, logical_and, and logical_not now follow Python's behavior with object arrays, instead of trying to call methods on the objects. For example the expression (3 and 'test') produces the string 'test', and now np.logical_and(np.array(3, 'O'), np.array('test', 'O')) produces 'test' as well. The ``.base`` attribute on ndarrays, which is used on views to ensure that the underlying array owning the memory is not deallocated prematurely, now collapses out references when you have a view-of-a-view. For example:: a = np.arange(10) b = a[1:] c = b[1:] In numpy 1.6, ``c.base`` is ``b``, and ``c.base.base`` is ``a``. In numpy 1.7, ``c.base`` is ``a``. To increase backwards compatibility for software which relies on the old behavior of ``.base``, we only 'skip over' objects which have exactly the same type as the newly created view. This makes a difference if you use ``ndarray`` subclasses. For example, if we have a mix of ``ndarray`` and ``matrix`` objects which are all views on the same original ``ndarray``:: a = np.arange(10) b = np.asmatrix(a) c = b[0, 1:] d = c[0, 1:] then ``d.base`` will be ``b``. This is because ``d`` is a ``matrix`` object, and so the collapsing process only continues so long as it encounters other ``matrix`` objects. It considers ``c``, ``b``, and ``a`` in that order, and ``b`` is the last entry in that list which is a ``matrix`` object.
  • Deprecations
  • General
  • Specifying a custom string formatter with a `_format` array attribute is deprecated. The new `formatter` keyword in ``numpy.set_printoptions`` or ``numpy.array2string`` can be used instead. The deprecated imports in the polynomial package have been removed. ``concatenate`` now raises DepractionWarning for 1D arrays if ``axis != 0``. Versions of numpy < 1.7.0 ignored axis argument value for 1D arrays. We allow this for now, but in due course we will raise an error.
  • C-API
  • Direct access to the fields of PyArrayObject* has been deprecated. Direct access has been recommended against for many releases. Expect similar deprecations for PyArray_Descr* and other core objects in the future as preparation for NumPy 2.0. The macros in old_defines.h are deprecated and will be removed in the next major release (>= 2.0). The sed script tools/replace_old_macros.sed can be used to replace these macros with the newer versions. You can test your code against the deprecated C API by #defining NPY_NO_DEPRECATED_API to the target version number, for example NPY_1_7_API_VERSION, before including any NumPy headers. The ``NPY_CHAR`` member of the ``NPY_TYPES`` enum is deprecated and will be removed in NumPy 1.8.

New in Numpy (Numerical Python) 1.7.0 Beta 2 (Sep 20, 2012)

  • MAINT: silence Cython warnings about changes dtype/ufunc size.
  • These warnings are visible whenever you import scipy (or another package) that was compiled against an older numpy than is installed. For example compiled against 1.5.1, like current scipy binaries are, and used with 1.7.0.
  • These warnings aren't useful; if numpy would really break its ABI it would be
  • noticed in no time without these warnings.
  • FIX: use py24-compatible version of virtualenv on Travis
  • Travis recently upgraded to virtualenv 1.8, which has dropped support for Python 2.4. So, in our Python 2.4 setup script, we need to explicitly fetch and use virtualenv 1.7. Likewise for pip 1.1.
  • File imported from the already-fixed version for patsy:
  • FIX: loosen numerical tolerance in test_pareto()
  • The problem was that in 32bit Ubuntu 12.04, one gets the following:
  • home/njs/numpy/.tox/py27/local/lib/python2.7/site-packages/numpy/random/tests/test_random.py(363)test_pareto()
  • np.testing.assert_array_almost_equal(actual, desired, decimal=15)
  • Pdb) actual[1, 0]
  • 52828779.702948704
  • Pdb) desired[1, 0]
  • 52828779.702948518
  • and the test was comparing the numbers to 1e-14, which obviously failed.
  • TST: Add test for boolean insert
  • TST: Add extra test for multidimensional inserts.
  • BUG: Fix for issues #378 and #392. This should fix the problems with numpy.insert(), where the input values were not checked for all scalar types and where values did not get inserted properly, but got duplicated by default.
  • BUG: fix npymath install location.
  • BUG: fix custom post_check.
  • BUG: forgot to build _dotblas in bento build.
  • REF: remove unused imports in bscript.
  • FIX: Regenerate mtrand.c with Cython 0.17
  • Retain backward compatibility. Enforce C order.
  • Improve ndindex execution speed.
  • BUG: Fix ticket #1588/gh issue #398, refcount error in clip
  • This patch enforces a strict dichotomy for the variables 'indescr' and 'newdescr', so they are either NULL, or they own a reference.
  • Following the consequences of this allowed the reference error to be tracked down.
  • FIX: simplify the import statement
  • Fix returned copy
  • Fix returned copy so that copy of view with offsets copies only fields in view, not all the fields from original array. Also add unit tests to make sure this doesn't break when copy is fully deprecated in favor of returning a view.
  • MAINT: silence DeprecationWarning in np.safe_eval().
  • It comes from the Python compiler package, which isn't available on Python 3.x.
  • We already handle that issue by instead importing the ast module.
  • pavement.py: rename "yop" to "atlas"
  • BUG: fix bento build.
  • Remove test_recarray_from_long_formats
  • Add test for long number in shape specifier of dtype string
  • Add test for long numbers in numpy.rec.array formats string
  • Allow long numbers in numpy.rec.array formats string
  • Use PyUnicode_DecodeUTF32()
  • This function handles the swapping automatically and it returns a unicode object in one of: UCS1, UCS2 or UCS4 internal Python format.
  • Follow the C guidelines
  • Fix memory leak in concatenate.
  • Temporary array was not being freed after use.
  • FIX: Make sure the tests produce valid unicode
  • The tests are testing byte order for unicode, so we can only use such unicode data, so that both versions (swapped and unswapped) are valid unicode.
  • FIX: Fixes the PyUnicodeObject problem in py-3.3
  • Previously NumPy did not compile in Python 3.3 due to the changes in PEP 393.
  • This patch simply calls PyUnicode_FromKindAndData() from the new Python 3.3 API and possibly swaps the data before calling it if needed. The data in NumPy is always UCS4 and the PyUnicode_FromKindAndData() internally converts it to UCS1, UCS2 or UCS4 depending on the maximum code point.
  • The following tests now fail, because they produce invalid unicode in the process (will be fixed in the next patch):

New in Numpy (Numerical Python) 1.7.0 Beta 1 (Aug 21, 2012)

  • New features:
  • Reduction UFuncs Generalize axis= Parameter
  • Any ufunc.reduce function call, as well as other reductions like sum, prod, any, all, max and min support the ability to choose a subset of the axes to reduce over. Previously, one could say axis=None to mean all the axes or axis=# to pick a single axis. Now, one can also say axis=(#,#) to pick a list of axes for reduction.
  • Reduction UFuncs New keepdims= Parameter :
  • There is a new keepdims= parameter, which if set to True, doesn't throw away the reduction axes but instead sets them to have size one. When this option is set, the reduction result will broadcast correctly to the original operand which was reduced.
  • Datetime support:
  • .. note:: The datetime API is *experimental* in 1.7.0, and may undergo changes in future versions of NumPy. There have been a lot of fixes and enhancements to datetime64 compared to NumPy 1.6:
  • the parser is quite strict about only accepting ISO 8601 dates, with a few convenience extensions
  • converts between units correctly
  • datetime arithmetic works correctly
  • business day functionality (allows the datetime to be used in contexts where only certain days of the week are valid) The notes in `doc/source/reference/arrays.datetime.rst `_ (also available in the online docs at `arrays.datetime.html `_) should be consulted for more details.
  • Custom formatter for printing arrays:
  • See the new ``formatter`` parameter of the ``numpy.set_printoptions`` function. New function numpy.random.choice
  • A generic sampling function has been added which will generate samples from a given array-like. The samples can be with or without replacement, and with uniform or given non-uniform probabilities.
  • New function isclose:
  • Returns a boolean array where two arrays are element-wise equal within a tolerance. Both relative and absolute tolerance can be specified. The function is NA aware.
  • Preliminary multi-dimensional support in the polynomial package:
  • Axis keywords have been added to the integration and differentiation functions and a tensor keyword was added to the evaluation functions. These additions allow multi-dimensional coefficient arrays to be used in those functions. New functions for evaluating 2-D and 3-D coefficient arrays on grids or sets of points were added together with 2-D and 3-D pseudo-Vandermonde matrices that can be used for fitting.
  • Ability to pad rank-n arrays:
  • pad module containing functions for padding n-dimensional arrays has been added. The various private padding functions are exposed as options to a public 'pad' function. Example:: pad(a, 5, mode='mean') Current modes are ``constant``, ``edge``, ``linear_ramp``, ``maximum``, ``mean``, ``median``, ``minimum``, ``reflect``, ``symmetric``, ``wrap``, and ````.
  • New argument to searchsorted:
  • The function searchsorted now accepts a 'sorter' argument that is a permuation array that sorts the array to search.
  • C API:
  • New function ``PyArray_RequireWriteable`` provides a consistent interface for checking array writeability
  • any C code which works with arrays whose WRITEABLE flag is not known to be True a priori, should make sure to call this function before writing. NumPy C Style Guide added (``doc/C_STYLE_GUIDE.rst.txt``).
  • Changes:
  • General:
  • The function np.concatenate tries to match the layout of its input arrays. Previously, the layout did not follow any particular reason, and depended in an undesirable way on the particular axis chosen for concatenation. A bug was also fixed which silently allowed out of bounds axis arguments. The ufuncs logical_or, logical_and, and logical_not now follow Python's behavior with object arrays, instead of trying to call methods on the objects. For example the expression (3 and 'test') produces the string 'test', and now np.logical_and(np.array(3, 'O'), np.array('test', 'O')) produces 'test' as well.
  • Deprecations:
  • General:
  • Specifying a custom string formatter with a `_format` array attribute is deprecated. The new `formatter` keyword in ``numpy.set_printoptions`` or ``numpy.array2string`` can be used instead. The deprecated imports in the polynomial package have been removed.
  • C-API:
  • Direct access to the fields of PyArrayObject* has been deprecated. Direct access has been recommended against for many releases. Expect similar deprecations for PyArray_Descr* and other core objects in the future as preparation for NumPy 2.0. The macros in old_defines.h are deprecated and will be removed in the next major release (>= 2.0). The sed script tools/replace_old_macros.sed can be used to replace these macros with the newer versions. You can test your code against the deprecated C API by #defining NPY_NO_DEPRECATED_API to the target version number, for example NPY_1_7_API_VERSION, before including any NumPy headers.

New in Numpy (Numerical Python) 1.7.0 Beta (Aug 16, 2012)

  • New features:
  • Reduction UFuncs Generalize axis= Parameter
  • Any ufunc.reduce function call, as well as other reductions like sum, prod, any, all, max and min support the ability to choose a subset of the axes to reduce over. Previously, one could say axis=None to mean all the axes or axis=# to pick a single axis. Now, one can also say axis=(#,#) to pick a list of axes for reduction. Reduction UFuncs New keepdims= Parameter
  • There is a new keepdims= parameter, which if set to True, doesn't throw away the reduction axes but instead sets them to have size one. When this option is set, the reduction result will broadcast correctly to the original operand which was reduced.
  • Datetime support:
  • .. note:: The datetime API is *experimental* in 1.7.0, and may undergo changes in future versions of NumPy. There have been a lot of fixes and enhancements to datetime64 compared to NumPy 1.6: * the parser is quite strict about only accepting ISO 8601 dates, with a few convenience extensions converts between units correctly
  • datetime arithmetic works correctly
  • business day functionality (allows the datetime to be used in contexts where only certain days of the week are valid) The notes in `doc/source/reference/arrays.datetime.rst `_ (also available in the online docs at `arrays.datetime.html `_) should be consulted for more details.
  • Custom formatter for printing arrays:
  • See the new ``formatter`` parameter of the ``numpy.set_printoptions`` function.
  • New function numpy.random.choice:
  • A generic sampling function has been added which will generate samples from a given array-like. The samples can be with or without replacement, and with uniform or given non-uniform probabilities.
  • New function isclose:
  • Returns a boolean array where two arrays are element-wise equal within a tolerance. Both relative and absolute tolerance can be specified. The function is NA aware.
  • Preliminary multi-dimensional support in the polynomial package:
  • Axis keywords have been added to the integration and differentiation functions and a tensor keyword was added to the evaluation functions. These additions allow multi-dimensional coefficient arrays to be used in those functions. New functions for evaluating 2-D and 3-D coefficient arrays on grids or sets of points were added together with 2-D and 3-D pseudo-Vandermonde matrices that can be used for fitting.
  • Ability to pad rank-n arrays:
  • A pad module containing functions for padding n-dimensional arrays has been added. The various private padding functions are exposed as options to a public 'pad' function. Example:: pad(a, 5, mode='mean') Current modes are ``constant``, ``edge``, ``linear_ramp``, ``maximum``, ``mean``, ``median``, ``minimum``, ``reflect``, ``symmetric``, ``wrap``, and ````.
  • New argument to searchsorted:
  • The function searchsorted now accepts a 'sorter' argument that is a permuation array that sorts the array to search. C API ----- New function ``PyArray_RequireWriteable`` provides a consistent interface for checking array writeability -- any C code which works with arrays whose WRITEABLE flag is not known to be True a priori, should make sure to call this function before writing. NumPy C Style Guide added (``doc/C_STYLE_GUIDE.rst.txt``).
  • Changes:
  • General:
  • The function np.concatenate tries to match the layout of its input arrays. Previously, the layout did not follow any particular reason, and depended in an undesirable way on the particular axis chosen for concatenation. A bug was also fixed which silently allowed out of bounds axis arguments. The ufuncs logical_or, logical_and, and logical_not now follow Python's behavior with object arrays, instead of trying to call methods on the objects. For example the expression (3 and 'test') produces the string 'test', and now np.logical_and(np.array(3, 'O'), np.array('test', 'O')) produces 'test' as well.
  • Deprecations:
  • General:
  • Specifying a custom string formatter with a `_format` array attribute is deprecated. The new `formatter` keyword in ``numpy.set_printoptions`` or ``numpy.array2string`` can be used instead. The deprecated imports in the polynomial package have been removed.
  • C-API:
  • Direct access to the fields of PyArrayObject* has been deprecated. Direct access has been recommended against for many releases. Expect similar deprecations for PyArray_Descr* and other core objects in the future as preparation for NumPy 2.0. The macros in old_defines.h are deprecated and will be removed in the next major release (>= 2.0). The sed script tools/replace_old_macros.sed can be used to replace these macros with the newer versions. You can test your code against the deprecated C API by #defining NPY_NO_DEPRECATED_API to the target version number, for example NPY_1_7_API_VERSION, before including any NumPy headers.

New in Numpy (Numerical Python) 1.6.2 (May 21, 2012)

  • numpy.core issues fixed:
  • make unique() return consistent index
  • allow creating arrays from empty buffers or empty slices
  • correct note about correspondence vstack and concatenate
  • make argmin() work for datetime
  • fix allclose() to work for scalar inf
  • make np.median() work for 0-D arrays
  • make complex division by zero to yield inf properly
  • add scalar support for the format() function
  • explicitly check for NaNs in allclose()
  • allow floating ddof in std() and var()
  • fix regression for indexing chararrays with empty list
  • fix type hashing
  • deleting array attributes causes segfault
  • a**2.0 has incorrect type
  • make attribute/iterator_element deletions not segfault
  • fix segfault in searchsorted()
  • fix float16 __array_interface__ bug
  • numpy.lib issues fixed:
  • break reference cycle in NpzFile
  • savetxt() now handles complex arrays
  • allow bincount() to accept empty arrays
  • fixed histogramdd() bug with empty inputs
  • fix failing npyio test under py3k
  • fix extra nesting for subarray dtypes
  • make tril/triu return the same dtype as the original array
  • use Py_TYPE to access ob_type, so it works also on Py3
  • numpy.f2py changes:
  • ENH: Introduce new options extra_f77_compiler_args and extra_f90_compiler_args BLD: Improve reporting of fcompiler value
  • BUG: Fix f2py test_kind.py test
  • numpy.poly changes:
  • ENH: Add some tests for polynomial printing
  • ENH: Add companion matrix functions DOC: Rearrange the polynomial documents
  • BUG: Fix up links to classes
  • DOC: Add version added to some of the polynomial package modules
  • DOC: Document xxxfit functions in the polynomial package modules
  • BUG: The polynomial convenience classes let different types interact
  • DOC: Document the use of the polynomial convenience classes
  • DOC: Improve numpy reference documentation of polynomial classes
  • ENH: Improve the computation of polynomials from roots
  • STY: Code cleanup in polynomial
  • fromroots functions
  • DOC: Remove references to cast and NA, which were added in 1.7
  • numpy.distutils issues fixed:
  • change compile flag on AIX from -O5 to -O3 #1377 update HP compiler flags
  • provide better support for C++ code on HPUX
  • fix build for py3k + pip
  • BLD: raise a clearer warning in case of building without cleaning up first
  • BLD: follow build_ext coding convention in build_clib
  • BLD: fix up detection of Intel CPU on OS X in system_info.py
  • BLD: add support for the new X11 directory structure on Ubuntu & co.
  • BLD: add ufsparse to the libraries search path.
  • BLD: add 'pgfortran' as a valid compiler in the Portland Group BLD: update version match regexp for IBM AIX Fortran compilers.
  • numpy.random issues fixed:
  • BUG: Use npy_intp instead of long in mtrand

New in Numpy (Numerical Python) 1.6.1 (Jul 21, 2011)

  • BUG: Fix regression in printing polynomials.
  • BUG: defer numpy.distutils import in ctypeslib.

New in Numpy (Numerical Python) 1.6.0 (Jul 2, 2011)

  • New features:
  • New 16-bit floating point type
  • This release adds support for the IEEE 754-2008 binary16 format, available as the data type ``numpy.half``. Within Python, the type behaves similarly to `float` or `double`, and C extensions can add support for it with the exposed half-float API.
  • New iterator:
  • A new iterator has been added, replacing the functionality of the existing iterator and multi-iterator with a single object and API. This iterator works well with general memory layouts different from C or Fortran contiguous, and handles both standard NumPy and customized broadcasting. The buffering, automatic data type conversion, and optional output parameters, offered by ufuncs but difficult to replicate elsewhere, are now exposed by this iterator. Legendre, Laguerre, Hermite, HermiteE polynomials in``numpy.polynomial``
  • Extend the number of polynomials available in the polynomial package. In addition, a new ``window`` attribute has been added to the classes in order to specify the range the ``domain`` maps to. This is mostly useful for the Laguerre, Hermite, and HermiteE polynomials whose natural domains are infinite and provides a more intuitive way to get the correct mapping of values without playing unnatural tricks with the domain. Fortran assumed shape array and size function support in ``numpy.f2py``
  • F2py now supports wrapping Fortran 90 routines that use assumed shape arrays. Before such routines could be called from Python but the corresponding Fortran routines received assumed shape arrays as zero length arrays which caused unpredicted results. Thanks to Lorenz Hüdepohl for pointing out the correct way to interface routines with assumed shape arrays. In addition, f2py supports now automatic wrapping of Fortran routines that use two argument ``size`` function in dimension specifications.
  • Other new functions:
  • ``numpy.ravel_multi_index`` : Converts a multi-index tuple into an array of flat indices, applying boundary modes to the indices. ``numpy.einsum`` : Evaluate the Einstein summation convention. Using the Einstein summation convention, many common multi-dimensional array operations can be represented in a simple fashion. This function provides a way compute such summations. ``numpy.count_nonzero`` : Counts the number of non-zero elements in an array. ``numpy.result_type`` and ``numpy.min_scalar_type`` : These functions expose the underlying type promotion used by the ufuncs and other operations to determine the types of outputs. These improve upon the ``numpy.common_type`` and ``numpy.mintypecode`` which provide similar functionality but do not match the ufunc implementation.
  • Changes:
  • ``default error handling``
  • The default error handling has been change from ``print`` to ``warn`` for all except for ``underflow``, which remains as ``ignore``. ``numpy.distutils``
  • Several new compilers are supported for building Numpy: the Portland Group Fortran compiler on OS X, the PathScale compiler suite and the 64-bit Intel C compiler on Linux. ``numpy.testing``
  • The testing framework gained ``numpy.testing.assert_allclose``, which provides a more convenient way to compare floating point arrays than `assert_almost_equal`, `assert_approx_equal` and `assert_array_almost_equal`. ``C API``
  • In addition to the APIs for the new iterator and half data type, a number of other additions have been made to the C API. The type promotion mechanism used by ufuncs is exposed via ``PyArray_PromoteTypes``, ``PyArray_ResultType``, and ``PyArray_MinScalarType``. A new enumeration ``NPY_CASTING`` has been added which controls what types of casts are permitted. This is used by the new functions ``PyArray_CanCastArrayTo`` and ``PyArray_CanCastTypeTo``. A more flexible way to handle conversion of arbitrary python objects into arrays is exposed by ``PyArray_GetArrayParamsFromObject``.
  • Deprecated features:
  • The "normed" keyword in ``numpy.histogram`` is deprecated. Its functionality will be replaced by the new "density" keyword.
  • Removed features:
  • ``numpy.fft``
  • The functions `refft`, `refft2`, `refftn`, `irefft`, `irefft2`, `irefftn`, which were aliases for the same functions without the 'e' in the name, were removed. ``numpy.memmap``
  • The `sync()` and `close()` methods of memmap were removed. Use `flush()` and "del memmap" instead. ``numpy.lib``
  • The deprecated functions ``numpy.unique1d``, ``numpy.setmember1d``, ``numpy.intersect1d_nu`` and ``numpy.lib.ufunclike.log2`` were removed. ``numpy.ma``
  • Several deprecated items were removed from the ``numpy.ma`` module:: * ``numpy.ma.MaskedArray`` "raw_data" method * ``numpy.ma.MaskedArray`` constructor "flag" keyword * ``numpy.ma.make_mask`` "flag" keyword * ``numpy.ma.allclose`` "fill_value" keyword ``numpy.distutils``
  • The ``numpy.get_numpy_include`` function was removed, use ``numpy.get_include`` instead.