Blame doc/release/1.10.0-notes.rst

Packit 7a8e5e
==========================
Packit 7a8e5e
NumPy 1.10.0 Release Notes
Packit 7a8e5e
==========================
Packit 7a8e5e
Packit 7a8e5e
This release supports Python 2.6 - 2.7 and 3.2 - 3.5.
Packit 7a8e5e
Packit 7a8e5e
Packit 7a8e5e
Highlights
Packit 7a8e5e
==========
Packit 7a8e5e
* numpy.distutils now supports parallel compilation via the --parallel/-j
Packit 7a8e5e
  argument passed to setup.py build
Packit 7a8e5e
* numpy.distutils now supports additional customization via site.cfg to
Packit 7a8e5e
  control compilation parameters, i.e. runtime libraries, extra
Packit 7a8e5e
  linking/compilation flags.
Packit 7a8e5e
* Addition of *np.linalg.multi_dot*: compute the dot product of two or more
Packit 7a8e5e
  arrays in a single function call, while automatically selecting the fastest
Packit 7a8e5e
  evaluation order.
Packit 7a8e5e
* The new function `np.stack` provides a general interface for joining a
Packit 7a8e5e
  sequence of arrays along a new axis, complementing `np.concatenate` for
Packit 7a8e5e
  joining along an existing axis.
Packit 7a8e5e
* Addition of `nanprod` to the set of nanfunctions.
Packit 7a8e5e
* Support for the '@' operator in Python 3.5.
Packit 7a8e5e
Packit 7a8e5e
Dropped Support
Packit 7a8e5e
===============
Packit 7a8e5e
Packit 7a8e5e
* The _dotblas module has been removed. CBLAS Support is now in
Packit 7a8e5e
  Multiarray.
Packit 7a8e5e
* The testcalcs.py file has been removed.
Packit 7a8e5e
* The polytemplate.py file has been removed.
Packit 7a8e5e
* npy_PyFile_Dup and npy_PyFile_DupClose have been removed from
Packit 7a8e5e
  npy_3kcompat.h.
Packit 7a8e5e
* splitcmdline has been removed from numpy/distutils/exec_command.py.
Packit 7a8e5e
* try_run and get_output have been removed from
Packit 7a8e5e
  numpy/distutils/command/config.py
Packit 7a8e5e
* The a._format attribute is no longer supported for array printing.
Packit 7a8e5e
* Keywords ``skiprows`` and ``missing`` removed from np.genfromtxt.
Packit 7a8e5e
* Keyword ``old_behavior`` removed from np.correlate.
Packit 7a8e5e
Packit 7a8e5e
Future Changes
Packit 7a8e5e
==============
Packit 7a8e5e
Packit 7a8e5e
* In array comparisons like ``arr1 == arr2``, many corner cases
Packit 7a8e5e
  involving strings or structured dtypes that used to return scalars
Packit 7a8e5e
  now issue ``FutureWarning`` or ``DeprecationWarning``, and in the
Packit 7a8e5e
  future will be change to either perform elementwise comparisons or
Packit 7a8e5e
  raise an error.
Packit 7a8e5e
* In ``np.lib.split`` an empty array in the result always had dimension
Packit 7a8e5e
  ``(0,)`` no matter the dimensions of the array being split. In Numpy 1.11
Packit 7a8e5e
  that behavior will be changed so that the dimensions will be preserved. A
Packit 7a8e5e
  ``FutureWarning`` for this change has been in place since Numpy 1.9 but,
Packit 7a8e5e
  due to a bug, sometimes no warning was raised and the dimensions were
Packit 7a8e5e
  already preserved.
Packit 7a8e5e
* The SafeEval class will be removed in Numpy 1.11.
Packit 7a8e5e
* The alterdot and restoredot functions will be removed in Numpy 1.11.
Packit 7a8e5e
Packit 7a8e5e
See below for more details on these changes.
Packit 7a8e5e
Packit 7a8e5e
Compatibility notes
Packit 7a8e5e
===================
Packit 7a8e5e
Packit 7a8e5e
Default casting rule change
Packit 7a8e5e
---------------------------
Packit 7a8e5e
Default casting for inplace operations has changed to ``'same_kind'``. For
Packit 7a8e5e
instance, if n is an array of integers, and f is an array of floats, then
Packit 7a8e5e
``n += f`` will result in a ``TypeError``, whereas in previous Numpy
Packit 7a8e5e
versions the floats would be silently cast to ints. In the unlikely case
Packit 7a8e5e
that the example code is not an actual bug, it can be updated in a backward
Packit 7a8e5e
compatible way by rewriting it as ``np.add(n, f, out=n, casting='unsafe')``.
Packit 7a8e5e
The old ``'unsafe'`` default has been deprecated since Numpy 1.7.
Packit 7a8e5e
Packit 7a8e5e
numpy version string
Packit 7a8e5e
--------------------
Packit 7a8e5e
The numpy version string for development builds has been changed from
Packit 7a8e5e
``x.y.z.dev-githash`` to ``x.y.z.dev0+githash`` (note the +) in order to comply
Packit 7a8e5e
with PEP 440.
Packit 7a8e5e
Packit 7a8e5e
relaxed stride checking
Packit 7a8e5e
-----------------------
Packit 7a8e5e
NPY_RELAXED_STRIDE_CHECKING is now true by default.
Packit 7a8e5e
Packit 7a8e5e
UPDATE: In 1.10.2 the default value of  NPY_RELAXED_STRIDE_CHECKING was
Packit 7a8e5e
changed to false for back compatibility reasons. More time is needed before
Packit 7a8e5e
it can be made the default. As part of the roadmap a deprecation of
Packit 7a8e5e
dimension changing views of f_contiguous not c_contiguous arrays was also
Packit 7a8e5e
added.
Packit 7a8e5e
Packit 7a8e5e
Concatenation of 1d arrays along any but ``axis=0`` raises ``IndexError``
Packit 7a8e5e
-------------------------------------------------------------------------
Packit 7a8e5e
Using axis != 0 has raised a DeprecationWarning since NumPy 1.7, it now
Packit 7a8e5e
raises an error.
Packit 7a8e5e
Packit 7a8e5e
*np.ravel*, *np.diagonal* and *np.diag* now preserve subtypes
Packit 7a8e5e
-------------------------------------------------------------
Packit 7a8e5e
There was inconsistent behavior between *x.ravel()* and *np.ravel(x)*, as
Packit 7a8e5e
well as between *x.diagonal()* and *np.diagonal(x)*, with the methods
Packit 7a8e5e
preserving subtypes while the functions did not. This has been fixed and
Packit 7a8e5e
the functions now behave like the methods, preserving subtypes except in
Packit 7a8e5e
the case of matrices.  Matrices are special cased for backward
Packit 7a8e5e
compatibility and still return 1-D arrays as before. If you need to
Packit 7a8e5e
preserve the matrix subtype, use the methods instead of the functions.
Packit 7a8e5e
Packit 7a8e5e
*rollaxis* and *swapaxes* always return a view
Packit 7a8e5e
----------------------------------------------
Packit 7a8e5e
Previously, a view was returned except when no change was made in the order
Packit 7a8e5e
of the axes, in which case the input array was returned.  A view is now
Packit 7a8e5e
returned in all cases.
Packit 7a8e5e
Packit 7a8e5e
*nonzero* now returns base ndarrays
Packit 7a8e5e
-----------------------------------
Packit 7a8e5e
Previously, an inconsistency existed between 1-D inputs (returning a
Packit 7a8e5e
base ndarray) and higher dimensional ones (which preserved subclasses).
Packit 7a8e5e
Behavior has been unified, and the return will now be a base ndarray.
Packit 7a8e5e
Subclasses can still override this behavior by providing their own
Packit 7a8e5e
*nonzero* method.
Packit 7a8e5e
Packit 7a8e5e
C API
Packit 7a8e5e
-----
Packit 7a8e5e
The changes to *swapaxes* also apply to the *PyArray_SwapAxes* C function,
Packit 7a8e5e
which now returns a view in all cases.
Packit 7a8e5e
Packit 7a8e5e
The changes to *nonzero* also apply to the *PyArray_Nonzero* C function,
Packit 7a8e5e
which now returns a base ndarray in all cases.
Packit 7a8e5e
Packit 7a8e5e
The dtype structure (PyArray_Descr) has a new member at the end to cache
Packit 7a8e5e
its hash value.  This shouldn't affect any well-written applications.
Packit 7a8e5e
Packit 7a8e5e
The change to the concatenation function DeprecationWarning also affects
Packit 7a8e5e
PyArray_ConcatenateArrays,
Packit 7a8e5e
Packit 7a8e5e
recarray field return types
Packit 7a8e5e
---------------------------
Packit 7a8e5e
Previously the returned types for recarray fields accessed by attribute and by
Packit 7a8e5e
index were inconsistent, and fields of string type were returned as chararrays.
Packit 7a8e5e
Now, fields accessed by either attribute or indexing will return an ndarray for
Packit 7a8e5e
fields of non-structured type, and a recarray for fields of structured type.
Packit 7a8e5e
Notably, this affect recarrays containing strings with whitespace, as trailing
Packit 7a8e5e
whitespace is trimmed from chararrays but kept in ndarrays of string type.
Packit 7a8e5e
Also, the dtype.type of nested structured fields is now inherited.
Packit 7a8e5e
Packit 7a8e5e
recarray views
Packit 7a8e5e
--------------
Packit 7a8e5e
Viewing an ndarray as a recarray now automatically converts the dtype to
Packit 7a8e5e
np.record. See new record array documentation. Additionally, viewing a recarray
Packit 7a8e5e
with a non-structured dtype no longer converts the result's type to ndarray -
Packit 7a8e5e
the result will remain a recarray.
Packit 7a8e5e
Packit 7a8e5e
'out' keyword argument of ufuncs now accepts tuples of arrays
Packit 7a8e5e
-------------------------------------------------------------
Packit 7a8e5e
When using the 'out' keyword argument of a ufunc, a tuple of arrays, one per
Packit 7a8e5e
ufunc output, can be provided. For ufuncs with a single output a single array
Packit 7a8e5e
is also a valid 'out' keyword argument. Previously a single array could be
Packit 7a8e5e
provided in the 'out' keyword argument, and it would be used as the first
Packit 7a8e5e
output for ufuncs with multiple outputs, is deprecated, and will result in a
Packit 7a8e5e
`DeprecationWarning` now and an error in the future.
Packit 7a8e5e
Packit 7a8e5e
byte-array indices now raises an IndexError
Packit 7a8e5e
-------------------------------------------
Packit 7a8e5e
Indexing an ndarray using a byte-string in Python 3 now raises an IndexError
Packit 7a8e5e
instead of a ValueError.
Packit 7a8e5e
Packit 7a8e5e
Masked arrays containing objects with arrays
Packit 7a8e5e
--------------------------------------------
Packit 7a8e5e
For such (rare) masked arrays, getting a single masked item no longer returns a
Packit 7a8e5e
corrupted masked array, but a fully masked version of the item.
Packit 7a8e5e
Packit 7a8e5e
Median warns and returns nan when invalid values are encountered
Packit 7a8e5e
----------------------------------------------------------------
Packit 7a8e5e
Similar to mean, median and percentile now emits a Runtime warning and
Packit 7a8e5e
returns `NaN` in slices where a `NaN` is present.
Packit 7a8e5e
To compute the median or percentile while ignoring invalid values use the
Packit 7a8e5e
new `nanmedian` or `nanpercentile` functions.
Packit 7a8e5e
Packit 7a8e5e
Functions available from numpy.ma.testutils have changed
Packit 7a8e5e
--------------------------------------------------------
Packit 7a8e5e
All functions from numpy.testing were once available from
Packit 7a8e5e
numpy.ma.testutils but not all of them were redefined to work with masked
Packit 7a8e5e
arrays. Most of those functions have now been removed from
Packit 7a8e5e
numpy.ma.testutils with a small subset retained in order to preserve
Packit 7a8e5e
backward compatibility. In the long run this should help avoid mistaken use
Packit 7a8e5e
of the wrong functions, but it may cause import problems for some.
Packit 7a8e5e
Packit 7a8e5e
Packit 7a8e5e
New Features
Packit 7a8e5e
============
Packit 7a8e5e
Packit 7a8e5e
Reading extra flags from site.cfg
Packit 7a8e5e
---------------------------------
Packit 7a8e5e
Previously customization of compilation of dependency libraries and numpy
Packit 7a8e5e
itself was only accomblishable via code changes in the distutils package.
Packit 7a8e5e
Now numpy.distutils reads in the following extra flags from each group of the
Packit 7a8e5e
*site.cfg*:
Packit 7a8e5e
Packit 7a8e5e
* ``runtime_library_dirs/rpath``, sets runtime library directories to override
Packit 7a8e5e
    ``LD_LIBRARY_PATH``
Packit 7a8e5e
* ``extra_compile_args``, add extra flags to the compilation of sources
Packit 7a8e5e
* ``extra_link_args``, add extra flags when linking libraries
Packit 7a8e5e
Packit 7a8e5e
This should, at least partially, complete user customization.
Packit 7a8e5e
Packit 7a8e5e
*np.cbrt* to compute cube root for real floats
Packit 7a8e5e
----------------------------------------------
Packit 7a8e5e
*np.cbrt* wraps the C99 cube root function *cbrt*.
Packit 7a8e5e
Compared to *np.power(x, 1./3.)* it is well defined for negative real floats
Packit 7a8e5e
and a bit faster.
Packit 7a8e5e
Packit 7a8e5e
numpy.distutils now allows parallel compilation
Packit 7a8e5e
-----------------------------------------------
Packit 7a8e5e
By passing *--parallel=n* or *-j n* to *setup.py build* the compilation of
Packit 7a8e5e
extensions is now performed in *n* parallel processes.
Packit 7a8e5e
The parallelization is limited to files within one extension so projects using
Packit 7a8e5e
Cython will not profit because it builds extensions from single files.
Packit 7a8e5e
Packit 7a8e5e
*genfromtxt* has a new ``max_rows`` argument
Packit 7a8e5e
--------------------------------------------
Packit 7a8e5e
A ``max_rows`` argument has been added to *genfromtxt* to limit the
Packit 7a8e5e
number of rows read in a single call. Using this functionality, it is
Packit 7a8e5e
possible to read in multiple arrays stored in a single file by making
Packit 7a8e5e
repeated calls to the function.
Packit 7a8e5e
Packit 7a8e5e
New function *np.broadcast_to* for invoking array broadcasting
Packit 7a8e5e
--------------------------------------------------------------
Packit 7a8e5e
*np.broadcast_to* manually broadcasts an array to a given shape according to
Packit 7a8e5e
numpy's broadcasting rules. The functionality is similar to broadcast_arrays,
Packit 7a8e5e
which in fact has been rewritten to use broadcast_to internally, but only a
Packit 7a8e5e
single array is necessary.
Packit 7a8e5e
Packit 7a8e5e
New context manager *clear_and_catch_warnings* for testing warnings
Packit 7a8e5e
-------------------------------------------------------------------
Packit 7a8e5e
When Python emits a warning, it records that this warning has been emitted in
Packit 7a8e5e
the module that caused the warning, in a module attribute
Packit 7a8e5e
``__warningregistry__``.  Once this has happened, it is not possible to emit
Packit 7a8e5e
the warning again, unless you clear the relevant entry in
Packit 7a8e5e
``__warningregistry__``.  This makes is hard and fragile to test warnings,
Packit 7a8e5e
because if your test comes after another that has already caused the warning,
Packit 7a8e5e
you will not be able to emit the warning or test it. The context manager
Packit 7a8e5e
``clear_and_catch_warnings`` clears warnings from the module registry on entry
Packit 7a8e5e
and resets them on exit, meaning that warnings can be re-raised.
Packit 7a8e5e
Packit 7a8e5e
*cov* has new ``fweights`` and ``aweights`` arguments
Packit 7a8e5e
-----------------------------------------------------
Packit 7a8e5e
The ``fweights`` and ``aweights`` arguments add new functionality to
Packit 7a8e5e
covariance calculations by applying two types of weighting to observation
Packit 7a8e5e
vectors. An array of ``fweights`` indicates the number of repeats of each
Packit 7a8e5e
observation vector, and an array of ``aweights`` provides their relative
Packit 7a8e5e
importance or probability.
Packit 7a8e5e
Packit 7a8e5e
Support for the '@' operator in Python 3.5+
Packit 7a8e5e
-------------------------------------------
Packit 7a8e5e
Python 3.5 adds support for a matrix multiplication operator '@' proposed
Packit 7a8e5e
in PEP465. Preliminary support for that has been implemented, and an
Packit 7a8e5e
equivalent function ``matmul`` has also been added for testing purposes and
Packit 7a8e5e
use in earlier Python versions. The function is preliminary and the order
Packit 7a8e5e
and number of its optional arguments can be expected to change.
Packit 7a8e5e
Packit 7a8e5e
New argument ``norm`` to fft functions
Packit 7a8e5e
--------------------------------------
Packit 7a8e5e
The default normalization has the direct transforms unscaled and the inverse
Packit 7a8e5e
transforms are scaled by :math:`1/n`. It is possible to obtain unitary
Packit 7a8e5e
transforms by setting the keyword argument ``norm`` to ``"ortho"`` (default is
Packit 7a8e5e
`None`) so that both direct and inverse transforms will be scaled by
Packit 7a8e5e
:math:`1/\\sqrt{n}`.
Packit 7a8e5e
Packit 7a8e5e
Packit 7a8e5e
Improvements
Packit 7a8e5e
============
Packit 7a8e5e
Packit 7a8e5e
*np.digitize* using binary search
Packit 7a8e5e
---------------------------------
Packit 7a8e5e
*np.digitize* is now implemented in terms of *np.searchsorted*. This means
Packit 7a8e5e
that a binary search is used to bin the values, which scales much better
Packit 7a8e5e
for larger number of bins than the previous linear search. It also removes
Packit 7a8e5e
the requirement for the input array to be 1-dimensional.
Packit 7a8e5e
Packit 7a8e5e
*np.poly* now casts integer inputs to float
Packit 7a8e5e
-------------------------------------------
Packit 7a8e5e
*np.poly* will now cast 1-dimensional input arrays of integer type to double
Packit 7a8e5e
precision floating point, to prevent integer overflow when computing the monic
Packit 7a8e5e
polynomial. It is still possible to obtain higher precision results by
Packit 7a8e5e
passing in an array of object type, filled e.g. with Python ints.
Packit 7a8e5e
Packit 7a8e5e
*np.interp* can now be used with periodic functions
Packit 7a8e5e
---------------------------------------------------
Packit 7a8e5e
*np.interp* now has a new parameter *period* that supplies the period of the
Packit 7a8e5e
input data *xp*. In such case, the input data is properly normalized to the
Packit 7a8e5e
given period and one end point is added to each extremity of *xp* in order to
Packit 7a8e5e
close the previous and the next period cycles, resulting in the correct
Packit 7a8e5e
interpolation behavior.
Packit 7a8e5e
Packit 7a8e5e
*np.pad* supports more input types for ``pad_width`` and ``constant_values``
Packit 7a8e5e
----------------------------------------------------------------------------
Packit 7a8e5e
``constant_values`` parameters now accepts NumPy arrays and float values.
Packit 7a8e5e
NumPy arrays are supported as input for ``pad_width``, and an exception is
Packit 7a8e5e
raised if its values are not of integral type.
Packit 7a8e5e
Packit 7a8e5e
*np.argmax* and *np.argmin* now support an ``out`` argument
Packit 7a8e5e
-----------------------------------------------------------
Packit 7a8e5e
The ``out`` parameter was added to *np.argmax* and *np.argmin* for consistency
Packit 7a8e5e
with *ndarray.argmax* and *ndarray.argmin*. The new parameter behaves exactly
Packit 7a8e5e
as it does in those methods.
Packit 7a8e5e
Packit 7a8e5e
More system C99 complex functions detected and used
Packit 7a8e5e
---------------------------------------------------
Packit 7a8e5e
All of the functions ``in complex.h`` are now detected. There are new
Packit 7a8e5e
fallback implementations of the following functions.
Packit 7a8e5e
Packit 7a8e5e
* npy_ctan,
Packit 7a8e5e
* npy_cacos, npy_casin, npy_catan
Packit 7a8e5e
* npy_ccosh, npy_csinh, npy_ctanh,
Packit 7a8e5e
* npy_cacosh, npy_casinh, npy_catanh
Packit 7a8e5e
Packit 7a8e5e
As a result of these improvements, there will be some small changes in
Packit 7a8e5e
returned values, especially for corner cases.
Packit 7a8e5e
Packit 7a8e5e
*np.loadtxt* support for the strings produced by the ``float.hex`` method
Packit 7a8e5e
-------------------------------------------------------------------------
Packit 7a8e5e
The strings produced by ``float.hex`` look like ``0x1.921fb54442d18p+1``,
Packit 7a8e5e
so this is not the hex used to represent unsigned integer types.
Packit 7a8e5e
Packit 7a8e5e
*np.isclose* properly handles minimal values of integer dtypes
Packit 7a8e5e
--------------------------------------------------------------
Packit 7a8e5e
In order to properly handle minimal values of integer types, *np.isclose* will
Packit 7a8e5e
now cast to the float dtype during comparisons. This aligns its behavior with
Packit 7a8e5e
what was provided by *np.allclose*.
Packit 7a8e5e
Packit 7a8e5e
*np.allclose* uses *np.isclose* internally.
Packit 7a8e5e
-------------------------------------------
Packit 7a8e5e
*np.allclose* now uses *np.isclose* internally and inherits the ability to
Packit 7a8e5e
compare NaNs as equal by setting ``equal_nan=True``. Subclasses, such as
Packit 7a8e5e
*np.ma.MaskedArray*, are also preserved now.
Packit 7a8e5e
Packit 7a8e5e
*np.genfromtxt* now handles large integers correctly
Packit 7a8e5e
----------------------------------------------------
Packit 7a8e5e
*np.genfromtxt* now correctly handles integers larger than ``2**31-1`` on
Packit 7a8e5e
32-bit systems and larger than ``2**63-1`` on 64-bit systems (it previously
Packit 7a8e5e
crashed with an ``OverflowError`` in these cases). Integers larger than
Packit 7a8e5e
``2**63-1`` are converted to floating-point values.
Packit 7a8e5e
Packit 7a8e5e
*np.load*, *np.save* have pickle backward compatibility flags
Packit 7a8e5e
-------------------------------------------------------------
Packit 7a8e5e
Packit 7a8e5e
The functions *np.load* and *np.save* have additional keyword
Packit 7a8e5e
arguments for controlling backward compatibility of pickled Python
Packit 7a8e5e
objects. This enables Numpy on Python 3 to load npy files containing
Packit 7a8e5e
object arrays that were generated on Python 2.
Packit 7a8e5e
Packit 7a8e5e
MaskedArray support for more complicated base classes
Packit 7a8e5e
-----------------------------------------------------
Packit 7a8e5e
Built-in assumptions that the baseclass behaved like a plain array are being
Packit 7a8e5e
removed. In particular, setting and getting elements and ranges will respect
Packit 7a8e5e
baseclass overrides of ``__setitem__`` and ``__getitem__``, and arithmetic
Packit 7a8e5e
will respect overrides of ``__add__``, ``__sub__``, etc.
Packit 7a8e5e
Packit 7a8e5e
Changes
Packit 7a8e5e
=======
Packit 7a8e5e
Packit 7a8e5e
dotblas functionality moved to multiarray
Packit 7a8e5e
-----------------------------------------
Packit 7a8e5e
The cblas versions of dot, inner, and vdot have been integrated into
Packit 7a8e5e
the multiarray module. In particular, vdot is now a multiarray function,
Packit 7a8e5e
which it was not before.
Packit 7a8e5e
Packit 7a8e5e
stricter check of gufunc signature compliance
Packit 7a8e5e
---------------------------------------------
Packit 7a8e5e
Inputs to generalized universal functions are now more strictly checked
Packit 7a8e5e
against the function's signature: all core dimensions are now required to
Packit 7a8e5e
be present in input arrays; core dimensions with the same label must have
Packit 7a8e5e
the exact same size; and output core dimension's must be specified, either
Packit 7a8e5e
by a same label input core dimension or by a passed-in output array.
Packit 7a8e5e
Packit 7a8e5e
views returned from *np.einsum* are writeable
Packit 7a8e5e
---------------------------------------------
Packit 7a8e5e
Views returned by *np.einsum* will now be writeable whenever the input
Packit 7a8e5e
array is writeable.
Packit 7a8e5e
Packit 7a8e5e
*np.argmin* skips NaT values
Packit 7a8e5e
----------------------------
Packit 7a8e5e
Packit 7a8e5e
*np.argmin* now skips NaT values in datetime64 and timedelta64 arrays,
Packit 7a8e5e
making it consistent with *np.min*, *np.argmax* and *np.max*.
Packit 7a8e5e
Packit 7a8e5e
Packit 7a8e5e
Deprecations
Packit 7a8e5e
============
Packit 7a8e5e
Packit 7a8e5e
Array comparisons involving strings or structured dtypes
Packit 7a8e5e
--------------------------------------------------------
Packit 7a8e5e
Packit 7a8e5e
Normally, comparison operations on arrays perform elementwise
Packit 7a8e5e
comparisons and return arrays of booleans. But in some corner cases,
Packit 7a8e5e
especially involving strings are structured dtypes, NumPy has
Packit 7a8e5e
historically returned a scalar instead. For example::
Packit 7a8e5e
Packit 7a8e5e
  ### Current behaviour
Packit 7a8e5e
Packit 7a8e5e
  np.arange(2) == "foo"
Packit 7a8e5e
  # -> False
Packit 7a8e5e
Packit 7a8e5e
  np.arange(2) < "foo"
Packit 7a8e5e
  # -> True on Python 2, error on Python 3
Packit 7a8e5e
Packit 7a8e5e
  np.ones(2, dtype="i4,i4") == np.ones(2, dtype="i4,i4,i4")
Packit 7a8e5e
  # -> False
Packit 7a8e5e
Packit 7a8e5e
Continuing work started in 1.9, in 1.10 these comparisons will now
Packit 7a8e5e
raise ``FutureWarning`` or ``DeprecationWarning``, and in the future
Packit 7a8e5e
they will be modified to behave more consistently with other
Packit 7a8e5e
comparison operations, e.g.::
Packit 7a8e5e
Packit 7a8e5e
  ### Future behaviour
Packit 7a8e5e
Packit 7a8e5e
  np.arange(2) == "foo"
Packit 7a8e5e
  # -> array([False, False])
Packit 7a8e5e
Packit 7a8e5e
  np.arange(2) < "foo"
Packit 7a8e5e
  # -> error, strings and numbers are not orderable
Packit 7a8e5e
Packit 7a8e5e
  np.ones(2, dtype="i4,i4") == np.ones(2, dtype="i4,i4,i4")
Packit 7a8e5e
  # -> [False, False]
Packit 7a8e5e
Packit 7a8e5e
SafeEval
Packit 7a8e5e
--------
Packit 7a8e5e
The SafeEval class in numpy/lib/utils.py is deprecated and will be removed
Packit 7a8e5e
in the next release.
Packit 7a8e5e
Packit 7a8e5e
alterdot, restoredot
Packit 7a8e5e
--------------------
Packit 7a8e5e
The alterdot and restoredot functions no longer do anything, and are
Packit 7a8e5e
deprecated.
Packit 7a8e5e
Packit 7a8e5e
pkgload, PackageLoader
Packit 7a8e5e
----------------------
Packit 7a8e5e
These ways of loading packages are now deprecated.
Packit 7a8e5e
Packit 7a8e5e
bias, ddof arguments to corrcoef
Packit 7a8e5e
--------------------------------
Packit 7a8e5e
Packit 7a8e5e
The values for the ``bias`` and ``ddof`` arguments to the ``corrcoef``
Packit 7a8e5e
function canceled in the division implied by the correlation coefficient and
Packit 7a8e5e
so had no effect on the returned values.
Packit 7a8e5e
Packit 7a8e5e
We now deprecate these arguments to ``corrcoef`` and the masked array version
Packit 7a8e5e
``ma.corrcoef``.
Packit 7a8e5e
Packit 7a8e5e
Because we are deprecating the ``bias`` argument to ``ma.corrcoef``, we also
Packit 7a8e5e
deprecate the use of the ``allow_masked`` argument as a positional argument,
Packit 7a8e5e
as its position will change with the removal of ``bias``.  ``allow_masked``
Packit 7a8e5e
will in due course become a keyword-only argument.
Packit 7a8e5e
Packit 7a8e5e
dtype string representation changes
Packit 7a8e5e
-----------------------------------
Packit 7a8e5e
Since 1.6, creating a dtype object from its string representation, e.g.
Packit 7a8e5e
``'f4'``, would issue a deprecation warning if the size did not correspond
Packit 7a8e5e
to an existing type, and default to creating a dtype of the default size
Packit 7a8e5e
for the type. Starting with this release, this will now raise a ``TypeError``.
Packit 7a8e5e
Packit 7a8e5e
The only exception is object dtypes, where both ``'O4'`` and ``'O8'`` will
Packit 7a8e5e
still issue a deprecation warning. This platform-dependent representation
Packit 7a8e5e
will raise an error in the next release.
Packit 7a8e5e
Packit 7a8e5e
In preparation for this upcoming change, the string representation of an
Packit 7a8e5e
object dtype, i.e. ``np.dtype(object).str``, no longer includes the item
Packit 7a8e5e
size, i.e. will return ``'|O'`` instead of ``'|O4'`` or ``'|O8'`` as
Packit 7a8e5e
before.