>>> help( np ) Help on package numpy: NAME numpy FILE c:\miniconda2\lib\site-packages\numpy\__init__.py DESCRIPTION NumPy ===== Provides 1. An array object of arbitrary homogeneous items 2. Fast mathematical operations over arrays 3. Linear Algebra, Fourier Transforms, Random Number Generation How to use the documentation ---------------------------- Documentation is available in two forms: docstrings provided with the code, and a loose standing reference guide, available from `the NumPy homepage `_. We recommend exploring the docstrings using `IPython `_, an advanced Python shell with TAB-completion and introspection capabilities. See below for further instructions. The docstring examples assume that `numpy` has been imported as `np`:: >>> import numpy as np Code snippets are indicated by three greater-than signs:: >>> x = 42 >>> x = x + 1 Use the built-in ``help`` function to view a function's docstring:: >>> help(np.sort) ... # doctest: +SKIP For some objects, ``np.info(obj)`` may provide additional help. This is particularly true if you see the line "Help on ufunc object:" at the top of the help() page. Ufuncs are implemented in C, not Python, for speed. The native Python help() does not know how to view their help, but our np.info() function does. To search for documents containing a keyword, do:: >>> np.lookfor('keyword') ... # doctest: +SKIP General-purpose documents like a glossary and help on the basic concepts of numpy are available under the ``doc`` sub-module:: >>> from numpy import doc >>> help(doc) ... # doctest: +SKIP Available subpackages --------------------- doc Topical documentation on broadcasting, indexing, etc. lib Basic functions used by several sub-packages. random Core Random Tools linalg Core Linear Algebra Tools fft Core FFT routines polynomial Polynomial tools testing Numpy testing tools f2py Fortran to Python Interface Generator. distutils Enhancements to distutils with support for Fortran compilers support and more. Utilities --------- test Run numpy unittests show_config Show numpy build configuration dual Overwrite certain functions with high-performance Scipy tools matlib Make everything matrices. __version__ Numpy version string Viewing documentation using IPython ----------------------------------- Start IPython with the NumPy profile (``ipython -p numpy``), which will import `numpy` under the alias `np`. Then, use the ``cpaste`` command to paste examples into the shell. To see which functions are available in `numpy`, type ``np.`` (where ```` refers to the TAB key), or use ``np.*cos*?`` (where ```` refers to the ENTER key) to narrow down the list. To view the docstring for a function, use ``np.cos?`` (to view the docstring) and ``np.cos??`` (to view the source code). Copies vs. in-place operation ----------------------------- Most of the functions in `numpy` return a copy of the array argument (e.g., `np.sort`). In-place versions of these functions are often available as array methods, i.e. ``x = np.array([1,2,3]); x.sort()``. Exceptions to this rule are documented. PACKAGE CONTENTS __config__ _import_tools add_newdocs compat (package) core (package) ctypeslib distutils (package) doc (package) dual f2py (package) fft (package) lib (package) linalg (package) ma (package) matlib matrixlib (package) polynomial (package) random (package) setup testing (package) version SUBMODULES _mat char emath rec CLASSES [[[omit CLASSES from this summary]]] FUNCTIONS add_docstring(...) add_docstring(obj, docstring) Add a docstring to a built-in obj if possible. If the obj already has a docstring raise a RuntimeError If this routine does not know how to add a docstring to the object raise a TypeError add_newdoc(place, obj, doc) Adds documentation to obj which is in module place. ... add_newdoc_ufunc = _add_newdoc_ufunc(...) add_ufunc_docstring(ufunc, new_docstring) Replace the docstring for a ufunc with new_docstring. This method will only work if the current docstring for the ufunc is NULL. (At the C level, i.e. when ufunc->doc is NULL.) ... alen(a) Return the length of the first dimension of the input array. ... all(a, axis=None, out=None, keepdims=False) Test whether all array elements along a given axis evaluate to True. ... allclose(a, b, rtol=1e-05, atol=1e-08, equal_nan=False) Returns True if two arrays are element-wise equal within a tolerance. ... alltrue(a, axis=None, out=None, keepdims=False) Check if all elements of input array are true. See Also -------- numpy.all : Equivalent function; see for details. alterdot() Change `dot`, `vdot`, and `inner` to use accelerated BLAS functions. Typically, as a user of Numpy, you do not explicitly call this function. If Numpy is built with an accelerated BLAS, this function is automatically called when Numpy is imported. ... amax(a, axis=None, out=None, keepdims=False) Return the maximum of an array or maximum along an axis. Parameters ---------- a : array_like Input data. axis : None or int or tuple of ints, optional Axis or axes along which to operate. By default, flattened input is used. .. versionadded: 1.7.0 If this is a tuple of ints, the maximum is selected over multiple axes, instead of a single axis or all the axes as before. out : ndarray, optional Alternative output array in which to place the result. Must be of the same shape and buffer length as the expected output. See `doc.ufuncs` (Section "Output arguments") for more details. keepdims : bool, optional If this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the original `arr`. Returns ------- amax : ndarray or scalar Maximum of `a`. If `axis` is None, the result is a scalar value. If `axis` is given, the result is an array of dimension ``a.ndim - 1``. See Also -------- amin : The minimum value of an array along a given axis, propagating any NaNs. nanmax : The maximum value of an array along a given axis, ignoring any NaNs. maximum : Element-wise maximum of two arrays, propagating any NaNs. fmax : Element-wise maximum of two arrays, ignoring any NaNs. argmax : Return the indices of the maximum values. nanmin, minimum, fmin Notes ----- NaN values are propagated, that is if at least one item is NaN, the corresponding max value will be NaN as well. To ignore NaN values (MATLAB behavior), please use nanmax. Don't use `amax` for element-wise comparison of 2 arrays; when ``a.shape[0]`` is 2, ``maximum(a[0], a[1])`` is faster than ``amax(a, axis=0)``. Examples -------- >>> a = np.arange(4).reshape((2,2)) >>> a array([[0, 1], [2, 3]]) >>> np.amax(a) # Maximum of the flattened array 3 >>> np.amax(a, axis=0) # Maxima along the first axis array([2, 3]) >>> np.amax(a, axis=1) # Maxima along the second axis array([1, 3]) >>> b = np.arange(5, dtype=np.float) >>> b[2] = np.NaN >>> np.amax(b) nan >>> np.nanmax(b) 4.0 amin(a, axis=None, out=None, keepdims=False) Return the minimum of an array or minimum along an axis. Parameters ---------- a : array_like Input data. axis : None or int or tuple of ints, optional Axis or axes along which to operate. By default, flattened input is used. .. versionadded: 1.7.0 If this is a tuple of ints, the minimum is selected over multiple axes, instead of a single axis or all the axes as before. out : ndarray, optional Alternative output array in which to place the result. Must be of the same shape and buffer length as the expected output. See `doc.ufuncs` (Section "Output arguments") for more details. keepdims : bool, optional If this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the original `arr`. Returns ------- amin : ndarray or scalar Minimum of `a`. If `axis` is None, the result is a scalar value. If `axis` is given, the result is an array of dimension ``a.ndim - 1``. See Also -------- amax : The maximum value of an array along a given axis, propagating any NaNs. nanmin : The minimum value of an array along a given axis, ignoring any NaNs. minimum : Element-wise minimum of two arrays, propagating any NaNs. fmin : Element-wise minimum of two arrays, ignoring any NaNs. argmin : Return the indices of the minimum values. nanmax, maximum, fmax Notes ----- NaN values are propagated, that is if at least one item is NaN, the corresponding min value will be NaN as well. To ignore NaN values (MATLAB behavior), please use nanmin. Don't use `amin` for element-wise comparison of 2 arrays; when ``a.shape[0]`` is 2, ``minimum(a[0], a[1])`` is faster than ``amin(a, axis=0)``. Examples -------- >>> a = np.arange(4).reshape((2,2)) >>> a array([[0, 1], [2, 3]]) >>> np.amin(a) # Minimum of the flattened array 0 >>> np.amin(a, axis=0) # Minima along the first axis array([0, 1]) >>> np.amin(a, axis=1) # Minima along the second axis array([0, 2]) >>> b = np.arange(5, dtype=np.float) >>> b[2] = np.NaN >>> np.amin(b) nan >>> np.nanmin(b) 0.0 angle(z, deg=0) Return the angle of the complex argument. Parameters ---------- z : array_like A complex number or sequence of complex numbers. deg : bool, optional Return angle in degrees if True, radians if False (default). Returns ------- angle : ndarray or scalar The counterclockwise angle from the positive real axis on the complex plane, with dtype as numpy.float64. See Also -------- arctan2 absolute Examples -------- >>> np.angle([1.0, 1.0j, 1+1j]) # in radians array([ 0. , 1.57079633, 0.78539816]) >>> np.angle(1+1j, deg=True) # in degrees 45.0 any(a, axis=None, out=None, keepdims=False) Test whether any array element along a given axis evaluates to True. Returns single boolean unless `axis` is not ``None`` Parameters ---------- a : array_like Input array or object that can be converted to an array. axis : None or int or tuple of ints, optional Axis or axes along which a logical OR reduction is performed. The default (`axis` = `None`) is to perform a logical OR over all the dimensions of the input array. `axis` may be negative, in which case it counts from the last to the first axis. .. versionadded:: 1.7.0 If this is a tuple of ints, a reduction is performed on multiple axes, instead of a single axis or all the axes as before. out : ndarray, optional Alternate output array in which to place the result. It must have the same shape as the expected output and its type is preserved (e.g., if it is of type float, then it will remain so, returning 1.0 for True and 0.0 for False, regardless of the type of `a`). See `doc.ufuncs` (Section "Output arguments") for details. keepdims : bool, optional If this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the original `arr`. Returns ------- any : bool or ndarray A new boolean or `ndarray` is returned unless `out` is specified, in which case a reference to `out` is returned. See Also -------- ndarray.any : equivalent method all : Test whether all elements along a given axis evaluate to True. Notes ----- Not a Number (NaN), positive infinity and negative infinity evaluate to `True` because these are not equal to zero. Examples -------- >>> np.any([[True, False], [True, True]]) True >>> np.any([[True, False], [False, False]], axis=0) array([ True, False], dtype=bool) >>> np.any([-1, 0, 5]) True >>> np.any(np.nan) True >>> o=np.array([False]) >>> z=np.any([-1, 4, 5], out=o) >>> z, o (array([ True], dtype=bool), array([ True], dtype=bool)) >>> # Check now that z is a reference to o >>> z is o True >>> id(z), id(o) # identity of z and o # doctest: +SKIP (191614240, 191614240) append(arr, values, axis=None) Append values to the end of an array. ... apply_along_axis(func1d, axis, arr, *args, **kwargs) Apply a function to 1-D slices along the given axis. ... apply_over_axes(func, a, axes) Apply a function repeatedly over multiple axes. `func` is called as `res = func(a, axis)`, where `axis` is the first element of `axes`. The result `res` of the function call must have either the same dimensions as `a` or one less dimension. If `res` has one less dimension than `a`, a dimension is inserted before `axis`. The call to `func` is then repeated for each axis in `axes`, with `res` as the first argument. ... arange(...) arange([start,] stop[, step,], dtype=None) Return evenly spaced values within a given interval. ... argmax(a, axis=None, out=None) Returns the indices of the maximum values along an axis. ... argmin(a, axis=None, out=None) Returns the indices of the minimum values along an axis. ... argpartition(a, kth, axis=-1, kind='introselect', order=None) Perform an indirect partition along the given axis using the algorithm specified by the `kind` keyword. It returns an array of indices of the same shape as `a` that index data along the given axis in partitioned order. ... argsort(a, axis=-1, kind='quicksort', order=None) Returns the indices that would sort an array. ... argwhere(a) Find the indices of array elements that are non-zero, grouped by element. ... around(a, decimals=0, out=None) Evenly round to the given number of decimals. ... array(...) array(object, dtype=None, copy=True, order=None, subok=False, ndmin=0) Create an array. ... See Also -------- empty, empty_like, zeros, zeros_like, ones, ones_like, fill ... array2string(a, max_line_width=None, precision=None, suppress_small=None, separator=' ', prefix='', style=, formatter=None) Return a string representation of an array. ... array_equal(a1, a2) True if two arrays have the same shape and elements, False otherwise. ... array_equiv(a1, a2) Returns True if input arrays are shape consistent and all elements equal. ... array_repr(arr, max_line_width=None, precision=None, suppress_small=None) Return the string representation of an array. ... array_split(ary, indices_or_sections, axis=0) Split an array into multiple sub-arrays. ... array_str(a, max_line_width=None, precision=None, suppress_small=None) Return a string representation of the data in an array. ... asanyarray(a, dtype=None, order=None) Convert the input to an ndarray, but pass ndarray subclasses through. Parameters ... Examples -------- Convert a list into an array: >>> a = [1, 2] >>> np.asanyarray(a) array([1, 2]) ... asarray(a, dtype=None, order=None) Convert the input to an array. ... asarray_chkfinite(a, dtype=None, order=None) Convert the input to an array, checking for NaNs or Infs. ... ascontiguousarray(a, dtype=None) Return a contiguous array in memory (C order). ... asfarray(a, dtype=) Return an array converted to a float type. ... asfortranarray(a, dtype=None) Return an array laid out in Fortran order in memory. ... asmatrix(data, dtype=None) Interpret the input as a matrix. ... asscalar(a) Convert an array of size 1 to its scalar equivalent. ... atleast_1d(*arys) Convert inputs to arrays with at least one dimension. ... atleast_2d(*arys) View inputs as arrays with at least two dimensions. ... atleast_3d(*arys) View inputs as arrays with at least three dimensions. ... average(a, axis=None, weights=None, returned=False) Compute the weighted average along the specified axis. ... bartlett(M) Return the Bartlett window. The Bartlett window is very similar to a triangular window, except that the end points are at zero. It is often used in signal processing for tapering a signal, without generating too much ripple in the frequency domain. ... base_repr(number, base=2, padding=0) Return a string representation of a number in the given base system. ... binary_repr(num, width=None) Return the binary representation of the input number as a string. ... bincount(...) bincount(x, weights=None, minlength=None) ... blackman(M) Return the Blackman window. The Blackman window is a taper formed by using the first three terms of a summation of cosines. It was designed to have close to the minimal leakage possible. It is close to optimal, only slightly worse than a Kaiser window. ... bmat(obj, ldict=None, gdict=None) Build a matrix object from a string, nested sequence, or array. ... broadcast_arrays(*args, **kwargs) Broadcast any number of arrays against each other. ... broadcast_to(array, shape, subok=False) Broadcast an array to a new shape. ... busday_count(...) busday_count(begindates, enddates, weekmask='1111100', holidays=[], busdaycal=None, out=None) Counts the number of valid days between `begindates` and `enddates`, not including the day of `enddates`. ... busday_offset(...) busday_offset(dates, offsets, roll='raise', weekmask='1111100', holidays=None, busdaycal=None, out=None) ... byte_bounds(a) Returns pointers to the end-points of an array. ... can_cast(...) can_cast(from, totype, casting = 'safe') ... choose(a, choices, out=None, mode='raise') Construct an array from an index array and a set of arrays to choose from. ... clip(a, a_min, a_max, out=None) Clip (limit) the values in an array. Given an interval, values outside the interval are clipped to the interval edges. For example, if an interval of ``[0, 1]`` is specified, values smaller than 0 become 0, and values larger than 1 become 1. ... column_stack(tup) Stack 1-D arrays as columns into a 2-D array. ... common_type(*arrays) Return a scalar type which is common to the input arrays. ... compare_chararrays(...) compress(condition, a, axis=None, out=None) Return selected slices of an array along given axis. ... concatenate(...) concatenate((a1, a2, ...), axis=0) Join a sequence of arrays along an existing axis. ... convolve(a, v, mode='full') Returns the discrete, linear convolution of two one-dimensional sequences. ... copy(a, order='K') Return an array copy of the given object. ... copyto(...) copyto(dst, src, casting='same_kind', where=None) Copies values from one array to another, broadcasting as necessary. .. corrcoef(x, y=None, rowvar=1, bias=, ddof=) Return Pearson product-moment correlation coefficients. ... correlate(a, v, mode='valid') Cross-correlation of two 1-dimensional sequences. ... count_nonzero(...) count_nonzero(a) Counts the number of non-zero values in the array ``a``. ... cov(m, y=None, rowvar=1, bias=0, ddof=None, fweights=None, aweights=None) Estimate a covariance matrix, given data and weights. ... cross(a, b, axisa=-1, axisb=-1, axisc=-1, axis=None) Return the cross product of two (arrays of) vectors. ... cumprod(a, axis=None, dtype=None, out=None) Return the cumulative product of elements along a given axis. ... cumproduct(a, axis=None, dtype=None, out=None) Return the cumulative product over the given axis. ... cumsum(a, axis=None, dtype=None, out=None) Return the cumulative sum of the elements along a given axis. ... datetime_as_string(...) datetime_data(...) delete(arr, obj, axis=None) Return a new array with sub-arrays along an axis deleted. For a one dimensional array, this returns those entries not returned by `arr[obj]`. ... See Also -------- insert : Insert elements into an array. append : Append elements at the end of an array. Notes ----- Often it is preferable to use a boolean mask. For example: >>> mask = np.ones(len(arr), dtype=bool) >>> mask[[0,2,4]] = False >>> result = arr[mask,...] ... deprecate(*args, **kwargs) Issues a DeprecationWarning, adds warning to `old_name`'s docstring, rebinds ``old_name.__name__`` and returns the new function object. .. deprecate_with_doc lambda msg diag(v, k=0) Extract a diagonal or construct a diagonal array. .. diag_indices(n, ndim=2) Return the indices to access the main diagonal of an array. ... diag_indices_from(arr) Return the indices to access the main diagonal of an n-dimensional array. ... diagflat(v, k=0) Create a two-dimensional array with the flattened input as a diagonal. ... diagonal(a, offset=0, axis1=0, axis2=1) Return specified diagonals. ... diff(a, n=1, axis=-1) Calculate the n-th order discrete difference along given axis. ... digitize(...) digitize(x, bins, right=False) Return the indices of the bins to which each value in input array belongs. ... See Also -------- bincount, histogram, unique ... disp(mesg, device=None, linefeed=True) Display a message on a device. ... dot(...) dot(a, b, out=None) Dot product of two arrays. ... dsplit(ary, indices_or_sections) Split array into multiple sub-arrays along the 3rd axis (depth). ... dstack(tup) Stack arrays in sequence depth wise (along third axis). ... ediff1d(ary, to_end=None, to_begin=None) The differences between consecutive elements of an array. ... einsum(...) einsum(subscripts, *operands, out=None, dtype=None, order='K', casting='safe') Evaluates the Einstein summation convention on the operands. 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. The best way to understand this function is to try the examples below, which show how many common NumPy functions can be implemented as calls to `einsum`. ... empty(...) empty(shape, dtype=float, order='C') ... empty_like(...) empty_like(a, dtype=None, order='K', subok=True) Return a new array with the same shape and type as a given array. ... expand_dims(a, axis) Expand the shape of an array. .... extract(condition, arr) Return the elements of an array that satisfy some condition. ... eye(N, M=None, k=0, dtype=) Return a 2-D array with ones on the diagonal and zeros elsewhere. ... fastCopyAndTranspose = _fastCopyAndTranspose(...) _fastCopyAndTranspose(a) fill_diagonal(a, val, wrap=False) Fill the main diagonal of the given array of any dimensionality. ... find_common_type(array_types, scalar_types) Determine common type following standard coercion rules. fix(x, y=None) Round to nearest integer towards zero. Round an array of floats element-wise to nearest integer towards zero. The rounded values are returned as floats. ... flatnonzero(a) Return indices that are non-zero in the flattened version of a. This is equivalent to a.ravel().nonzero()[0]. ... fliplr(m) Flip array in the left/right direction. Flip the entries in each row in the left/right direction. Columns are preserved, but appear in a different order than before. .... flipud(m) Flip array in the up/down direction. ... frombuffer(...) frombuffer(buffer, dtype=float, count=-1, offset=0) Interpret a buffer as a 1-dimensional array. ... fromfile(...) fromfile(file, dtype=float, count=-1, sep='') Construct an array from data in a text or binary file. A highly efficient way of reading binary data with a known data-type, as well as parsing simply formatted text files. Data written using the `tofile` method can be read using this function. ... fromfunction(function, shape, **kwargs) Construct an array by executing a function over each coordinate. The resulting array therefore has a value ``fn(x, y, z)`` at coordinate ``(x, y, z)``. ... fromiter(...) fromiter(iterable, dtype, count=-1) Create a new 1-dimensional array from an iterable object. ... frompyfunc(...) frompyfunc(func, nin, nout) Takes an arbitrary Python function and returns a Numpy ufunc. ... fromregex(file, regexp, dtype) Construct an array from a text file, using regular expression parsing. The returned array is always a structured array, and is constructed from all matches of the regular expression in the file. Groups in the regular expression are converted to fields of the structured array. ... fromstring(...) fromstring(string, dtype=float, count=-1, sep='') ... full(shape, fill_value, dtype=None, order='C') Return a new array of given shape and type, filled with `fill_value`. ... full_like(a, fill_value, dtype=None, order='K', subok=True) Return a full array with the same shape and type as a given array. ... fv(rate, nper, pmt, pv, when='end') Compute the future value. ... genfromtxt(fname, dtype=, comments='#', delimiter=None, skip_header=0, skip_footer=0, converters=None, missing_values=None, filling_values=None, usecols=None, names=None, excludelist=None, deletechars=None, replace_space='_', autostrip=False, case_sensitive=True, defaultfmt='f%i', unpack=None, usemask=False, loose=True, invalid_raise=True, max_rows=None) Load data from a text file, with missing values handled as specified. Each line past the first `skip_header` lines is split at the `delimiter` character, and characters following the `comments` character are discarded. ... get_array_wrap(*args) Find the wrapper for the array with the highest priority. In case of ties, leftmost wins. If no wrapper is found, return None get_include() Return the directory that contains the NumPy \*.h header files. Extension modules that need to compile against NumPy should use this function to locate the appropriate include directory. ... get_printoptions() Return the current print options. Returns ------- print_opts : dict Dictionary of current print options with keys - precision : int - threshold : int - edgeitems : int - linewidth : int - suppress : bool - nanstr : str - infstr : str - formatter : dict of callables For a full description of these options, see `set_printoptions`. See Also -------- set_printoptions, set_string_function getbuffer(...) getbuffer(obj [,offset[, size]]) ... getbufsize() Return the size of the buffer used in ufuncs. Returns ------- getbufsize : int Size of ufunc buffer in bytes. geterr() Get the current way of handling floating-point errors. ... geterrcall() Return the current callback function used on floating-point errors. ... geterrobj(...) geterrobj() Return the current object that defines floating-point error handling. ... gradient(f, *varargs, **kwargs) Return the gradient of an N-dimensional array. The gradient is computed using second order accurate central differences in the interior and either first differences or second order accurate one-sides (forward or backwards) differences at the boundaries. The returned gradient hence has the same shape as the input array. ... hamming(M) Return the Hamming window. The Hamming window is a taper formed by using a weighted cosine. ... hanning(M) Return the Hanning window. The Hanning window is a taper formed by using a weighted cosine. ... histogram(a, bins=10, range=None, normed=False, weights=None, density=None) Compute the histogram of a set of data. ... histogram2d(x, y, bins=10, range=None, normed=False, weights=None) Compute the bi-dimensional histogram of two data samples. ... histogramdd(sample, bins=10, range=None, normed=False, weights=None) Compute the multidimensional histogram of some data. ... hsplit(ary, indices_or_sections) Split an array into multiple sub-arrays horizontally (column-wise). Please refer to the `split` documentation. `hsplit` is equivalent to `split` with ``axis=1``, the array is always split along the second axis regardless of the array dimension. ... hstack(tup) Stack arrays in sequence horizontally (column wise). ... i0(x) Modified Bessel function of the first kind, order 0. ... identity(n, dtype=None) Return the identity array. ... imag(val) Return the imaginary part of the elements of the array. ... in1d(ar1, ar2, assume_unique=False, invert=False) Test whether each element of a 1-D array is also present in a second array. ... indices(dimensions, dtype=) Return an array representing the indices of a grid. ... The indices can be used as an index into an array. >>> x = np.arange(20).reshape(5, 4) >>> row, col = np.indices((2, 3)) >>> x[row, col] array([[0, 1, 2], [4, 5, 6]]) Note that it would be more straightforward in the above example to extract the required elements directly with ``x[:2, :3]``. info(object=None, maxwidth=76, output=, toplevel='numpy') Get help information for a function, class, or module. ... inner(...) inner(a, b) Inner product of two arrays. Ordinary inner product of vectors for 1-D arrays (without complex conjugation), in higher dimensions a sum product over the last axes. ... insert(arr, obj, values, axis=None) Insert values along the given axis before the given indices. ... int_asbuffer(...) interp(x, xp, fp, left=None, right=None, period=None) One-dimensional linear interpolation. Returns the one-dimensional piecewise linear interpolant to a function with given values at discrete data-points. ... intersect1d(ar1, ar2, assume_unique=False) Find the intersection of two arrays. Return the sorted, unique values that are in both of the input arrays. ... ipmt(rate, per, nper, pv, fv=0.0, when='end') Compute the interest portion of a payment. ... irr(values) Return the Internal Rate of Return (IRR). ... is_busday(...) is_busday(dates, weekmask='1111100', holidays=None, busdaycal=None, out=None) ... isclose(a, b, rtol=1e-05, atol=1e-08, equal_nan=False) Returns a boolean array where two arrays are element-wise equal within a tolerance. ... iscomplex(x) Returns a bool array, where True if input element is complex. ... iscomplexobj(x) Check for a complex type or an array of complex numbers. ... isfortran(a) Returns True if the array is Fortran contiguous but *not* C contiguous. ... isneginf(x, y=None) Test element-wise for negative infinity, return result as bool array. ... isposinf(x, y=None) Test element-wise for positive infinity, return result as bool array. ... isreal(x) Returns a bool array, where True if input element is real. If element has complex type with zero complex part, the return value for that element is True. ... isrealobj(x) Return True if x is a not complex type or an array of complex numbers. ... isscalar(num) Returns True if the type of `num` is a scalar type. ... issctype(rep) Determines whether the given object represents a scalar data-type. ... issubclass_(arg1, arg2) Determine if a class is a subclass of a second class. ... issubdtype(arg1, arg2) Returns True if first argument is a typecode lower/equal in type hierarchy. ... issubsctype(arg1, arg2) Determine if the first argument is a subclass of the second argument. ... iterable(y) Check whether or not an object can be iterated over. ... ix_(*args) Construct an open mesh from multiple sequences. This function takes N 1-D sequences and returns N outputs with N dimensions each, such that the shape is 1 in all but one dimension and the dimension with the non-unit shape value cycles through all N dimensions. ... kaiser(M, beta) Return the Kaiser window. The Kaiser window is a taper formed by using a Bessel function. ... kron(a, b) Kronecker product of two arrays. Computes the Kronecker product, a composite array made of blocks of the second array scaled by the first. ... lexsort(...) lexsort(keys, axis=-1) Perform an indirect sort using a sequence of keys. ... linspace(start, stop, num=50, endpoint=True, retstep=False, dtype=None) Return evenly spaced numbers over a specified interval. ... load(file, mmap_mode=None, allow_pickle=True, fix_imports=True, encoding='ASCII') Load arrays or pickled objects from ``.npy``, ``.npz`` or pickled files. ... loads(...) loads(string) -- Load a pickle from the given string loadtxt(fname, dtype=, comments='#', delimiter=None, converters=None, skiprows=0, usecols=None, unpack=False, ndmin=0) Load data from a text file. Each row in the text file must have the same number of values. .. logspace(start, stop, num=50, endpoint=True, base=10.0, dtype=None) Return numbers spaced evenly on a log scale. ... lookfor(what, module=None, import_modules=True, regenerate=False, output=None) Do a keyword search on docstrings. A list of of objects that matched the search is displayed, sorted by relevance. All given keywords need to be found in the docstring for it to be returned as a result, but the order does not matter. ... mafromtxt(fname, **kwargs) Load ASCII data stored in a text file and return a masked array. ... mask_indices(n, mask_func, k=0) Return the indices to access (n, n) arrays, given a masking function. ... mat = asmatrix(data, dtype=None) Interpret the input as a matrix. Unlike `matrix`, `asmatrix` does not make a copy if the input is already a matrix or an ndarray. Equivalent to ``matrix(data, copy=False)``. Parameters ---------- data : array_like Input data. dtype : data-type Data-type of the output matrix. Returns ------- mat : matrix `data` interpreted as a matrix. Examples -------- >>> x = np.array([[1, 2], [3, 4]]) >>> m = np.asmatrix(x) >>> x[0,0] = 5 >>> m matrix([[5, 2], [3, 4]]) matmul(...) matmul(a, b, out=None) Matrix product of two arrays. ... maximum_sctype(t) Return the scalar type of highest precision of the same kind as the input. ... may_share_memory(...) Determine if two arrays can share memory ... mean(a, axis=None, dtype=None, out=None, keepdims=False) Compute the arithmetic mean along the specified axis. ... median(a, axis=None, out=None, overwrite_input=False, keepdims=False) Compute the median along the specified axis. ... meshgrid(*xi, **kwargs) Return coordinate matrices from coordinate vectors. ... min_scalar_type(...) min_scalar_type(a) ... mintypecode(typechars, typeset='GDFgdf', default='d') Return the character for the minimum-size type to which given types can be safely cast. The returned type character must represent the smallest size dtype such that an array of the returned type can handle the data from an array of all types in `typechars` (or if `typechars` is an array, then its dtype.char). ... mirr(values, finance_rate, reinvest_rate) Modified internal rate of return. ... msort(a) Return a copy of an array sorted along the first axis. ... nan_to_num(x) Replace nan with zero and inf with finite numbers. ... nanargmax(a, axis=None) Return the indices of the maximum values in the specified axis ignoring NaNs. For all-NaN slices ``ValueError`` is raised. Warning: the results cannot be trusted if a slice contains only NaNs and -Infs. ... nanargmin(a, axis=None) Return the indices of the minimum values in the specified axis ignoring NaNs. For all-NaN slices ``ValueError`` is raised. Warning: the results cannot be trusted if a slice contains only NaNs and Infs. ... nanmax(a, axis=None, out=None, keepdims=False) Return the maximum of an array or maximum along an axis, ignoring any NaNs. When all-NaN slices are encountered a ``RuntimeWarning`` is raised and NaN is returned for that slice. ... nanmean(a, axis=None, dtype=None, out=None, keepdims=False) Compute the arithmetic mean along the specified axis, ignoring NaNs. Returns the average of the array elements. The average is taken over the flattened array by default, otherwise over the specified axis. `float64` intermediate and return values are used for integer inputs. For all-NaN slices, NaN is returned and a `RuntimeWarning` is raised. ... nanmedian(a, axis=None, out=None, overwrite_input=False, keepdims=False) Compute the median along the specified axis, while ignoring NaNs. Returns the median of the array elements. ... nanmin(a, axis=None, out=None, keepdims=False) Return minimum of an array or minimum along an axis, ignoring any NaNs. When all-NaN slices are encountered a ``RuntimeWarning`` is raised and Nan is returned for that slice. ... nanpercentile(a, q, axis=None, out=None, overwrite_input=False, interpolation='linear', keepdims=False) Compute the qth percentile of the data along the specified axis, while ignoring nan values. Returns the qth percentile of the array elements. ... nanprod(a, axis=None, dtype=None, out=None, keepdims=0) Return the product of array elements over a given axis treating Not a Numbers (NaNs) as zero. One is returned for slices that are all-NaN or empty. ... nanstd(a, axis=None, dtype=None, out=None, ddof=0, keepdims=False) Compute the standard deviation along the specified axis, while ignoring NaNs. ... nansum(a, axis=None, dtype=None, out=None, keepdims=0) Return the sum of array elements over a given axis treating Not a Numbers (NaNs) as zero. ... nanvar(a, axis=None, dtype=None, out=None, ddof=0, keepdims=False) Compute the variance along the specified axis, while ignoring NaNs. ... ndfromtxt(fname, **kwargs) Load ASCII data stored in a file and return it as a single array. Parameters ---------- fname, kwargs : For a description of input parameters, see `genfromtxt`. See Also -------- numpy.genfromtxt : generic function. ndim(a) Return the number of dimensions of an array. ... nested_iters(...) newbuffer(...) newbuffer(size) Return a new uninitialized buffer object. Parameters ---------- size : int Size in bytes of returned buffer object. Returns ------- newbuffer : buffer object Returned, uninitialized buffer object of `size` bytes. nonzero(a) Return the indices of the elements that are non-zero. Returns a tuple of arrays, one for each dimension of `a`, containing the indices of the non-zero elements in that dimension. The values in `a` are always tested and returned in row-major, C-style order. The corresponding non-zero values can be obtained with:: a[nonzero(a)] To group the indices by element, rather than dimension, use:: transpose(nonzero(a)) The result of this is always a 2-D array, with a row for each non-zero element. Parameters ---------- a : array_like Input array. Returns ------- tuple_of_arrays : tuple Indices of elements that are non-zero. See Also -------- flatnonzero : Return indices that are non-zero in the flattened version of the input array. ndarray.nonzero : Equivalent ndarray method. count_nonzero : Counts the number of non-zero elements in the input array. Examples -------- >>> x = np.eye(3) >>> x array([[ 1., 0., 0.], [ 0., 1., 0.], [ 0., 0., 1.]]) >>> np.nonzero(x) (array([0, 1, 2]), array([0, 1, 2])) >>> x[np.nonzero(x)] array([ 1., 1., 1.]) >>> np.transpose(np.nonzero(x)) array([[0, 0], [1, 1], [2, 2]]) A common use for ``nonzero`` is to find the indices of an array, where a condition is True. Given an array `a`, the condition `a` > 3 is a boolean array and since False is interpreted as 0, np.nonzero(a > 3) yields the indices of the `a` where the condition is true. >>> a = np.array([[1,2,3],[4,5,6],[7,8,9]]) >>> a > 3 array([[False, False, False], [ True, True, True], [ True, True, True]], dtype=bool) >>> np.nonzero(a > 3) (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) The ``nonzero`` method of the boolean array can also be called. >>> (a > 3).nonzero() (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2])) nper(rate, pmt, pv, fv=0, when='end') Compute the number of periodic payments. ... npv(rate, values) Returns the NPV (Net Present Value) of a cash flow series. ... obj2sctype(rep, default=None) Return the scalar dtype or NumPy equivalent of Python type of an object. ... ones(shape, dtype=None, order='C') Return a new array of given shape and type, filled with ones. ... ones_like(a, dtype=None, order='K', subok=True) Return an array of ones with the same shape and type as a given array. ... outer(a, b, out=None) Compute the outer product of two vectors. ... packbits(...) packbits(myarray, axis=None) Packs the elements of a binary-valued array into bits in a uint8 array. ... pad(array, pad_width, mode=None, **kwargs) Pads an array. ... partition(a, kth, axis=-1, kind='introselect', order=None) Return a partitioned copy of an array. Creates a copy of the array with its elements rearranged in such a way that the value of the element in kth position is in the position it would be in a sorted array. All elements smaller than the kth element are moved before this element and all equal or greater are moved behind it. The ordering of the elements in the two partitions is undefined. ... percentile(a, q, axis=None, out=None, overwrite_input=False, interpolation='linear', keepdims=False) Compute the qth percentile of the data along the specified axis. Returns the qth percentile of the array elements. Parameters ---------- a : array_like Input array or object that can be converted to an array. q : float in range of [0,100] (or sequence of floats) Percentile to compute which must be between 0 and 100 inclusive. axis : int or sequence of int, optional Axis along which the percentiles are computed. The default (None) is to compute the percentiles along a flattened version of the array. A sequence of axes is supported since version 1.9.0. out : ndarray, optional Alternative output array in which to place the result. It must have the same shape and buffer length as the expected output, but the type (of the output) will be cast if necessary. overwrite_input : bool, optional If True, then allow use of memory of input array `a` for calculations. The input array will be modified by the call to percentile. This will save memory when you do not need to preserve the contents of the input array. In this case you should not make any assumptions about the content of the passed in array `a` after this function completes -- treat it as undefined. Default is False. Note that, if the `a` input is not already an array this parameter will have no effect, `a` will be converted to an array internally regardless of the value of this parameter. interpolation : {'linear', 'lower', 'higher', 'midpoint', 'nearest'} This optional parameter specifies the interpolation method to use, when the desired quantile lies between two data points `i` and `j`: * linear: `i + (j - i) * fraction`, where `fraction` is the fractional part of the index surrounded by `i` and `j`. * lower: `i`. * higher: `j`. * nearest: `i` or `j` whichever is nearest. * midpoint: (`i` + `j`) / 2. .. versionadded:: 1.9.0 keepdims : bool, optional If this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the original array `a`. .. versionadded:: 1.9.0 Returns ------- percentile : scalar or ndarray If a single percentile `q` is given and axis=None a scalar is returned. If multiple percentiles `q` are given an array holding the result is returned. The results are listed in the first axis. (If `out` is specified, in which case that array is returned instead). If the input contains integers, or floats of smaller precision than 64, then the output data-type is float64. Otherwise, the output data-type is the same as that of the input. See Also -------- mean, median Notes ----- Given a vector V of length N, the q-th percentile of V is the q-th ranked value in a sorted copy of V. The values and distances of the two nearest neighbors as well as the `interpolation` parameter will determine the percentile if the normalized ranking does not match q exactly. This function is the same as the median if ``q=50``, the same as the minimum if ``q=0`` and the same as the maximum if ``q=100``. Examples -------- >>> a = np.array([[10, 7, 4], [3, 2, 1]]) >>> a array([[10, 7, 4], [ 3, 2, 1]]) >>> np.percentile(a, 50) array([ 3.5]) >>> np.percentile(a, 50, axis=0) array([[ 6.5, 4.5, 2.5]]) >>> np.percentile(a, 50, axis=1) array([[ 7.], [ 2.]]) >>> m = np.percentile(a, 50, axis=0) >>> out = np.zeros_like(m) >>> np.percentile(a, 50, axis=0, out=m) array([[ 6.5, 4.5, 2.5]]) >>> m array([[ 6.5, 4.5, 2.5]]) >>> b = a.copy() >>> np.percentile(b, 50, axis=1, overwrite_input=True) array([[ 7.], [ 2.]]) >>> assert not np.all(a==b) >>> b = a.copy() >>> np.percentile(b, 50, axis=None, overwrite_input=True) array([ 3.5]) piecewise(x, condlist, funclist, *args, **kw) Evaluate a piecewise-defined function. Given a set of conditions and corresponding functions, evaluate each function on the input data wherever its condition is true. ... pkgload(*packages, **options) Load one or more packages into parent package top-level namespace. This function is intended to shorten the need to import many subpackages, say of scipy, constantly with statements such as import scipy.linalg, scipy.fftpack, scipy.etc... Instead, you can say: import scipy scipy.pkgload('linalg','fftpack',...) or scipy.pkgload() to load all of them in one call. ... place(arr, mask, vals) Change elements of an array based on conditional and input values. ... pmt(rate, nper, pv, fv=0, when='end') Compute the payment against loan principal plus interest. ... poly(seq_of_zeros) Find the coefficients of a polynomial with the given sequence of roots. Returns the coefficients of the polynomial whose leading coefficient is one for the given sequence of zeros (multiple roots must be included in the sequence as many times as their multiplicity; see Examples). A square matrix (or array, which will be treated as a matrix) can also be given, in which case the coefficients of the characteristic polynomial of the matrix are returned. ....... polyadd(a1, a2) Find the sum of two polynomials. Returns the polynomial resulting from the sum of two input polynomials. Each input must be either a poly1d object or a 1D sequence of polynomial coefficients, from highest to lowest degree. polyder(p, m=1) Return the derivative of the specified order of a polynomial. ... polydiv(u, v) Returns the quotient and remainder of polynomial division. The input arrays are the coefficients (including any coefficients equal to zero) of the "numerator" (dividend) and "denominator" (divisor) polynomials, respectively. ... polyfit(x, y, deg, rcond=None, full=False, w=None, cov=False) Least squares polynomial fit. Fit a polynomial ``p(x) = p[0] * x**deg + ... + p[deg]`` of degree `deg` to points `(x, y)`. Returns a vector of coefficients `p` that minimises the squared error. ... polyint(p, m=1, k=None) Return an antiderivative (indefinite integral) of a polynomial. The returned order `m` antiderivative `P` of polynomial `p` satisfies :math:`\frac{d^m}{dx^m}P(x) = p(x)` and is defined up to `m - 1` integration constants `k`. The constants determine the low-order polynomial part .. math:: \frac{k_{m-1}}{0!} x^0 + \ldots + \frac{k_0}{(m-1)!}x^{m-1} of `P` so that :math:`P^{(j)}(0) = k_{m-j-1}`. ... polymul(a1, a2) Find the product of two polynomials. Finds the polynomial resulting from the multiplication of the two input polynomials. Each input must be either a poly1d object or a 1D sequence of polynomial coefficients, from highest to lowest degree. ... polysub(a1, a2) Difference (subtraction) of two polynomials. Given two polynomials `a1` and `a2`, returns ``a1 - a2``. `a1` and `a2` can be either array_like sequences of the polynomials' coefficients (including coefficients equal to zero), or `poly1d` objects. ... polyval(p, x) Evaluate a polynomial at specific values. ... ppmt(rate, per, nper, pv, fv=0.0, when='end') Compute the payment against loan principal. ... prod(a, axis=None, dtype=None, out=None, keepdims=False) Return the product of array elements over a given axis. ... product(a, axis=None, dtype=None, out=None, keepdims=False) Return the product of array elements over a given axis. See Also -------- prod : equivalent function; see for details. promote_types(...) promote_types(type1, type2) Returns the data type with the smallest size and smallest scalar kind to which both ``type1`` and ``type2`` may be safely cast. The returned data type is always in native byte order. This function is symmetric and associative. ... ptp(a, axis=None, out=None) Range of values (maximum - minimum) along an axis. The name of the function comes from the acronym for 'peak to peak'. ... put(a, ind, v, mode='raise') Replaces specified elements of an array with given values. The indexing works on the flattened target array. `put` is roughly equivalent to: :: a.flat[ind] = v ... putmask(...) putmask(a, mask, values) Changes elements of an array based on conditional and input values. Sets ``a.flat[n] = values[n]`` for each n where ``mask.flat[n]==True``. If `values` is not the same size as `a` and `mask` then it will repeat. This gives behavior different from ``a[mask] = values``. Parameters ---------- a : array_like Target array. mask : array_like Boolean mask array. It has to be the same shape as `a`. values : array_like Values to put into `a` where `mask` is True. If `values` is smaller than `a` it will be repeated. See Also -------- place, put, take, copyto Examples -------- >>> x = np.arange(6).reshape(2, 3) >>> np.putmask(x, x>2, x**2) >>> x array([[ 0, 1, 2], [ 9, 16, 25]]) If `values` is smaller than `a` it is repeated: >>> x = np.arange(5) >>> np.putmask(x, x>1, [-33, -44]) >>> x array([ 0, 1, -33, -44, -33]) pv(rate, nper, pmt, fv=0.0, when='end') Compute the present value. ... rank(a) Return the number of dimensions of an array. ... rate(nper, pmt, pv, fv, when='end', guess=0.1, tol=1e-06, maxiter=100) Compute the rate of interest per period. ... ravel(a, order='C') Return a contiguous flattened array. ... ravel_multi_index(...) ravel_multi_index(multi_index, dims, mode='raise', order='C') Converts a tuple of index arrays into an array of flat indices, applying boundary modes to the multi-index. ... real(val) Return the real part of the elements of the array. Parameters ... real_if_close(a, tol=100) If complex input returns a real array if complex parts are close to zero. .... recfromcsv(fname, **kwargs) Load ASCII data stored in a comma-separated file. ... recfromtxt(fname, **kwargs) Load ASCII data from a file and return it in a record array. ... repeat(a, repeats, axis=None) Repeat elements of an array. ... require(a, dtype=None, requirements=None) Return an ndarray of the provided type that satisfies requirements. This function is useful to be sure that an array with the correct flags is returned for passing to compiled code (perhaps through ctypes). ... reshape(a, newshape, order='C') Gives a new shape to an array without changing its data. ... resize(a, new_shape) Return a new array with the specified shape. .. restoredot() Restore `dot`, `vdot`, and `innerproduct` to the default non-BLAS implementations. .. . result_type(...) result_type(*arrays_and_dtypes) ... roll(a, shift, axis=None) Roll array elements along a given axis. Elements that roll beyond the last position are re-introduced at the first. ... rollaxis(a, axis, start=0) Roll the specified axis backwards, until it lies in a given position. ... roots(p) Return the roots of a polynomial with coefficients given in p. ... array([-0.3125+0.46351241j, -0.3125-0.46351241j]) rot90(m, k=1) Rotate an array by 90 degrees in the counter-clockwise direction. .... round_(a, decimals=0, out=None) Round an array to the given number of decimals. Refer to `around` for full documentation. See Also -------- around : equivalent function row_stack = vstack(tup) Stack arrays in sequence vertically (row wise). .. safe_eval(source) Protected string evaluation. ... save(file, arr, allow_pickle=True, fix_imports=True) Save an array to a binary file in NumPy ``.npy`` format. ... savetxt(fname, X, fmt='%.18e', delimiter=' ', newline='\n', header='', footer='', comments='# ') Save an array to a text file. .... savez(file, *args, **kwds) Save several arrays into a single file in uncompressed ``.npz`` format. ... savez_compressed(file, *args, **kwds) Save several arrays into a single file in compressed ``.npz`` format. ... sctype2char(sctype) Return the string representation of a scalar dtype. . searchsorted(a, v, side='left', sorter=None) Find indices where elements should be inserted to maintain order. Find the indices into a sorted array `a` such that, if the corresponding elements in `v` were inserted before the indices, the order of `a` would be preserved. ... select(condlist, choicelist, default=0) Return an array drawn from elements in choicelist, depending on conditions. ... set_numeric_ops(...) set_numeric_ops(op1=func1, op2=func2, ...) Set numerical operators for array objects. ... >>> ignore = np.set_numeric_ops(**old_funcs) # restore operators set_printoptions(precision=None, threshold=None, edgeitems=None, linewidth=None, suppress=None, nanstr=None, infstr=None, formatter=None) Set printing options. These options determine the way floating point numbers, arrays and other NumPy objects are displayed. Parameters ---------- precision : int, optional Number of digits of precision for floating point output (default 8). threshold : int, optional Total number of array elements which trigger summarization rather than full repr (default 1000). edgeitems : int, optional Number of array items in summary at beginning and end of each dimension (default 3). linewidth : int, optional The number of characters per line for the purpose of inserting line breaks (default 75). suppress : bool, optional Whether or not suppress printing of small floating point values using scientific notation (default False). nanstr : str, optional String representation of floating point not-a-number (default nan). infstr : str, optional String representation of floating point infinity (default inf). formatter : dict of callables, optional If not None, the keys should indicate the type(s) that the respective formatting function applies to. Callables should return a string. Types that are not specified (by their corresponding keys) are handled by the default formatters. Individual types for which a formatter can be set are:: - 'bool' - 'int' - 'timedelta' : a `numpy.timedelta64` - 'datetime' : a `numpy.datetime64` - 'float' - 'longfloat' : 128-bit floats - 'complexfloat' - 'longcomplexfloat' : composed of two 128-bit floats - 'numpy_str' : types `numpy.string_` and `numpy.unicode_` - 'str' : all other strings Other keys that can be used to set a group of types at once are:: - 'all' : sets all types - 'int_kind' : sets 'int' - 'float_kind' : sets 'float' and 'longfloat' - 'complex_kind' : sets 'complexfloat' and 'longcomplexfloat' - 'str_kind' : sets 'str' and 'numpystr' See Also -------- get_printoptions, set_string_function, array2string Notes ----- `formatter` is always reset with a call to `set_printoptions`. Examples -------- Floating point precision can be set: >>> np.set_printoptions(precision=4) >>> print np.array([1.123456789]) [ 1.1235] ... set_string_function(f, repr=True) Set a Python function to be used when pretty printing arrays. ... setbufsize(size) Set the size of the buffer used in ufuncs. Parameters ---------- size : int Size of buffer. setdiff1d(ar1, ar2, assume_unique=False) Find the set difference of two arrays. Return the sorted, unique values in `ar1` that are not in `ar2`. ... seterr(all=None, divide=None, over=None, under=None, invalid=None) Set how floating-point errors are handled. ... seterrcall(func) Set the floating-point error callback function or log object. There are two ways to capture floating-point error messages. The first is to set the error-handler to 'call', using `seterr`. Then, set the function to call using this function. The second is to set the error-handler to 'log', using `seterr`. Floating-point errors then trigger a call to the 'write' method of the provided object. ... seterrobj(...) seterrobj(errobj) Set the object that defines floating-point error handling. The error object contains all information that defines the error handling behavior in Numpy. `seterrobj` is used internally by the other functions that set error handling behavior (`seterr`, `seterrcall`). ... setxor1d(ar1, ar2, assume_unique=False) Find the set exclusive-or of two arrays. Return the sorted, unique values that are in only one (not both) of the input arrays. ... shape(a) Return the shape of an array. ... show_config = show() sinc(x) Return the sinc function. The sinc function is :math:`\sin(\pi x)/(\pi x)`. ... size(a, axis=None) Return the number of elements along a given axis. ... sometrue(a, axis=None, out=None, keepdims=False) Check whether some values are true. Refer to `any` for full documentation. See Also -------- any : equivalent function sort(a, axis=-1, kind='quicksort', order=None) Return a sorted copy of an array. ... sort_complex(a) Sort a complex array using the real part first, then the imaginary part. ... source(object, output=) Print or write to a file the source code for a Numpy object. ... split(ary, indices_or_sections, axis=0) Split an array into multiple sub-arrays. ... squeeze(a, axis=None) Remove single-dimensional entries from the shape of an array. ... stack(arrays, axis=0) Join a sequence of arrays along a new axis. The `axis` parameter specifies the index of the new axis in the dimensions of the result. For example, if ``axis=0`` it will be the first dimension and if ``axis=-1`` it will be the last dimension. ... std(a, axis=None, dtype=None, out=None, ddof=0, keepdims=False) Compute the standard deviation along the specified axis. Returns the standard deviation, a measure of the spread of a distribution, of the array elements. The standard deviation is computed for the flattened array by default, otherwise over the specified axis. Parameters ---------- a : array_like Calculate the standard deviation of these values. axis : None or int or tuple of ints, optional Axis or axes along which the standard deviation is computed. The default is to compute the standard deviation of the flattened array. .. versionadded: 1.7.0 If this is a tuple of ints, a standard deviation is performed over multiple axes, instead of a single axis or all the axes as before. dtype : dtype, optional Type to use in computing the standard deviation. For arrays of integer type the default is float64, for arrays of float types it is the same as the array type. out : ndarray, optional Alternative output array in which to place the result. It must have the same shape as the expected output but the type (of the calculated values) will be cast if necessary. ddof : int, optional Means Delta Degrees of Freedom. The divisor used in calculations is ``N - ddof``, where ``N`` represents the number of elements. By default `ddof` is zero. keepdims : bool, optional If this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the original `arr`. Returns ------- standard_deviation : ndarray, see dtype parameter above. If `out` is None, return a new array containing the standard deviation, otherwise return a reference to the output array. See Also -------- var, mean, nanmean, nanstd, nanvar numpy.doc.ufuncs : Section "Output arguments" Notes ----- The standard deviation is the square root of the average of the squared deviations from the mean, i.e., ``std = sqrt(mean(abs(x - x.mean())**2))``. The average squared deviation is normally calculated as ``x.sum() / N``, where ``N = len(x)``. If, however, `ddof` is specified, the divisor ``N - ddof`` is used instead. In standard statistical practice, ``ddof=1`` provides an unbiased estimator of the variance of the infinite population. ``ddof=0`` provides a maximum likelihood estimate of the variance for normally distributed variables. The standard deviation computed in this function is the square root of the estimated variance, so even with ``ddof=1``, it will not be an unbiased estimate of the standard deviation per se. Note that, for complex numbers, `std` takes the absolute value before squaring, so that the result is always real and nonnegative. For floating-point input, the *std* is computed using the same precision the input has. Depending on the input data, this can cause the results to be inaccurate, especially for float32 (see example below). Specifying a higher-accuracy accumulator using the `dtype` keyword can alleviate this issue. Examples -------- >>> a = np.array([[1, 2], [3, 4]]) >>> np.std(a) 1.1180339887498949 >>> np.std(a, axis=0) array([ 1., 1.]) >>> np.std(a, axis=1) array([ 0.5, 0.5]) In single precision, std() can be inaccurate: >>> a = np.zeros((2, 512*512), dtype=np.float32) >>> a[0, :] = 1.0 >>> a[1, :] = 0.1 >>> np.std(a) 0.45000005 Computing the standard deviation in float64 is more accurate: >>> np.std(a, dtype=np.float64) 0.44999999925494177 sum(a, axis=None, dtype=None, out=None, keepdims=False) Sum of array elements over a given axis. ... swapaxes(a, axis1, axis2) Interchange two axes of an array. ... take(a, indices, axis=None, out=None, mode='raise') Take elements from an array along an axis. This function does the same thing as "fancy" indexing (indexing arrays using arrays); however, it can be easier to use if you need elements along a given axis. Parameters ---------- a : array_like The source array. indices : array_like The indices of the values to extract. .. versionadded:: 1.8.0 Also allow scalars for indices. axis : int, optional The axis over which to select values. By default, the flattened input array is used. out : ndarray, optional If provided, the result will be placed in this array. It should be of the appropriate shape and dtype. mode : {'raise', 'wrap', 'clip'}, optional Specifies how out-of-bounds indices will behave. * 'raise' -- raise an error (default) * 'wrap' -- wrap around * 'clip' -- clip to the range 'clip' mode means that all indices that are too large are replaced by the index that addresses the last element along that axis. Note that this disables indexing with negative numbers. Returns ------- subarray : ndarray The returned array has the same type as `a`. See Also -------- compress : Take elements using a boolean mask ndarray.take : equivalent method Examples -------- >>> a = [4, 3, 5, 7, 6, 8] >>> indices = [0, 1, 4] >>> np.take(a, indices) array([4, 3, 6]) In this example if `a` is an ndarray, "fancy" indexing can be used. >>> a = np.array(a) >>> a[indices] array([4, 3, 6]) If `indices` is not one dimensional, the output also has these dimensions. >>> np.take(a, [[0, 1], [2, 3]]) array([[4, 3], [5, 7]]) tensordot(a, b, axes=2) Compute tensor dot product along specified axes for arrays >= 1-D. ... tile(A, reps) Construct an array by repeating A the number of times given by reps. ... trace(a, offset=0, axis1=0, axis2=1, dtype=None, out=None) Return the sum along diagonals of the array. ... transpose(a, axes=None) Permute the dimensions of an array. ... trapz(y, x=None, dx=1.0, axis=-1) Integrate along the given axis using the composite trapezoidal rule. ... tri(N, M=None, k=0, dtype=) An array with ones at and below the given diagonal and zeros elsewhere. ... tril(m, k=0) Lower triangle of an array. ... tril_indices(n, k=0, m=None) Return the indices for the lower-triangle of an (n, m) array. ... tril_indices_from(arr, k=0) Return the indices for the lower-triangle of arr. See `tril_indices` for full details. ... trim_zeros(filt, trim='fb') Trim the leading and/or trailing zeros from a 1-D array or sequence. ... triu(m, k=0) Upper triangle of an array. ... triu_indices(n, k=0, m=None) Return the indices for the upper-triangle of an (n, m) array. ... triu_indices_from(arr, k=0) Return the indices for the upper-triangle of arr. See `triu_indices` for full details. ... typename(char) Return a description for the given data type code. Parameters ---------- char : str Data type code. Returns ------- out : str Description of the input data type code. See Also -------- dtype, typecodes Examples -------- >>> typechars = ['S1', '?', 'B', 'D', 'G', 'F', 'I', 'H', 'L', 'O', 'Q', ... 'S', 'U', 'V', 'b', 'd', 'g', 'f', 'i', 'h', 'l', 'q'] >>> for typechar in typechars: ... print typechar, ' : ', np.typename(typechar) ... S1 : character ? : bool B : unsigned char D : complex double precision G : complex long double precision F : complex single precision I : unsigned integer H : unsigned short L : unsigned long integer O : object Q : unsigned long long integer S : string U : unicode V : void b : signed char d : double precision g : long precision f : single precision i : integer h : short l : long integer q : long long integer union1d(ar1, ar2) Find the union of two arrays. Return the unique, sorted array of values that are in either of the two input arrays. Parameters ---------- ar1, ar2 : array_like Input arrays. They are flattened if they are not already 1D. Returns ------- union1d : ndarray Unique, sorted union of the input arrays. See Also -------- numpy.lib.arraysetops : Module with a number of other functions for performing set operations on arrays. Examples -------- >>> np.union1d([-1, 0, 1], [-2, 0, 2]) array([-2, -1, 0, 1, 2]) To find the union of more than two arrays, use functools.reduce: >>> from functools import reduce >>> reduce(np.union1d, ([1, 3, 4, 3], [3, 1, 2, 1], [6, 3, 4, 2])) array([1, 2, 3, 4, 6]) unique(ar, return_index=False, return_inverse=False, return_counts=False) Find the unique elements of an array. Returns the sorted unique elements of an array. There are three optional outputs in addition to the unique elements: the indices of the input array that give the unique values, the indices of the unique array that reconstruct the input array, and the number of times each unique value comes up in the input array. Parameters ---------- ar : array_like Input array. This will be flattened if it is not already 1-D. return_index : bool, optional If True, also return the indices of `ar` that result in the unique array. return_inverse : bool, optional If True, also return the indices of the unique array that can be used to reconstruct `ar`. return_counts : bool, optional If True, also return the number of times each unique value comes up in `ar`. .. versionadded:: 1.9.0 Returns ------- unique : ndarray The sorted unique values. unique_indices : ndarray, optional The indices of the first occurrences of the unique values in the (flattened) original array. Only provided if `return_index` is True. unique_inverse : ndarray, optional The indices to reconstruct the (flattened) original array from the unique array. Only provided if `return_inverse` is True. unique_counts : ndarray, optional The number of times each of the unique values comes up in the original array. Only provided if `return_counts` is True. .. versionadded:: 1.9.0 See Also -------- numpy.lib.arraysetops : Module with a number of other functions for performing set operations on arrays. Examples -------- >>> np.unique([1, 1, 2, 2, 3, 3]) array([1, 2, 3]) >>> a = np.array([[1, 1], [2, 3]]) >>> np.unique(a) array([1, 2, 3]) Return the indices of the original array that give the unique values: >>> a = np.array(['a', 'b', 'b', 'c', 'a']) >>> u, indices = np.unique(a, return_index=True) >>> u array(['a', 'b', 'c'], dtype='|S1') >>> indices array([0, 1, 3]) >>> a[indices] array(['a', 'b', 'c'], dtype='|S1') Reconstruct the input array from the unique values: >>> a = np.array([1, 2, 6, 4, 2, 3, 2]) >>> u, indices = np.unique(a, return_inverse=True) >>> u array([1, 2, 3, 4, 6]) >>> indices array([0, 1, 4, 3, 1, 2, 1]) >>> u[indices] array([1, 2, 6, 4, 2, 3, 2]) unpackbits(...) unpackbits(myarray, axis=None) Unpacks elements of a uint8 array into a binary-valued output array. ... unravel_index(...) unravel_index(indices, dims, order='C') Converts a flat index or array of flat indices into a tuple of coordinate arrays. ...... unwrap(p, discont=3.141592653589793, axis=-1) Unwrap by changing deltas between values to 2*pi complement. ... vander(x, N=None, increasing=False) Generate a Vandermonde matrix. ... var(a, axis=None, dtype=None, out=None, ddof=0, keepdims=False) Compute the variance along the specified axis. Returns the variance of the array elements, a measure of the spread of a distribution. The variance is computed for the flattened array by default, otherwise over the specified axis. Parameters ---------- a : array_like Array containing numbers whose variance is desired. If `a` is not an array, a conversion is attempted. axis : None or int or tuple of ints, optional Axis or axes along which the variance is computed. The default is to compute the variance of the flattened array. .. versionadded: 1.7.0 If this is a tuple of ints, a variance is performed over multiple axes, instead of a single axis or all the axes as before. dtype : data-type, optional Type to use in computing the variance. For arrays of integer type the default is `float32`; for arrays of float types it is the same as the array type. out : ndarray, optional Alternate output array in which to place the result. It must have the same shape as the expected output, but the type is cast if necessary. ddof : int, optional "Delta Degrees of Freedom": the divisor used in the calculation is ``N - ddof``, where ``N`` represents the number of elements. By default `ddof` is zero. keepdims : bool, optional If this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the original `arr`. Returns ------- variance : ndarray, see dtype parameter above If ``out=None``, returns a new array containing the variance; otherwise, a reference to the output array is returned. See Also -------- std , mean, nanmean, nanstd, nanvar numpy.doc.ufuncs : Section "Output arguments" Notes ----- The variance is the average of the squared deviations from the mean, i.e., ``var = mean(abs(x - x.mean())**2)``. The mean is normally calculated as ``x.sum() / N``, where ``N = len(x)``. If, however, `ddof` is specified, the divisor ``N - ddof`` is used instead. In standard statistical practice, ``ddof=1`` provides an unbiased estimator of the variance of a hypothetical infinite population. ``ddof=0`` provides a maximum likelihood estimate of the variance for normally distributed variables. Note that for complex numbers, the absolute value is taken before squaring, so that the result is always real and nonnegative. For floating-point input, the variance is computed using the same precision the input has. Depending on the input data, this can cause the results to be inaccurate, especially for `float32` (see example below). Specifying a higher-accuracy accumulator using the ``dtype`` keyword can alleviate this issue. Examples -------- >>> a = np.array([[1, 2], [3, 4]]) >>> np.var(a) 1.25 >>> np.var(a, axis=0) array([ 1., 1.]) >>> np.var(a, axis=1) array([ 0.25, 0.25]) In single precision, var() can be inaccurate: >>> a = np.zeros((2, 512*512), dtype=np.float32) >>> a[0, :] = 1.0 >>> a[1, :] = 0.1 >>> np.var(a) 0.20250003 Computing the variance in float64 is more accurate: >>> np.var(a, dtype=np.float64) 0.20249999932944759 >>> ((1-0.55)**2 + (0.1-0.55)**2)/2 0.2025 vdot(...) vdot(a, b) Return the dot product of two vectors. ... vsplit(ary, indices_or_sections) Split an array into multiple sub-arrays vertically (row-wise). ... vstack(tup) Stack arrays in sequence vertically (row wise). Take a sequence of arrays and stack them vertically to make a single array. Rebuild arrays divided by `vsplit`. ... where(...) where(condition, [x, y]) Return elements, either from `x` or `y`, depending on `condition`. If only `condition` is given, return ``condition.nonzero()``. Parameters ---------- condition : array_like, bool When True, yield `x`, otherwise yield `y`. x, y : array_like, optional Values from which to choose. `x` and `y` need to have the same shape as `condition`. Returns ------- out : ndarray or tuple of ndarrays If both `x` and `y` are specified, the output array contains elements of `x` where `condition` is True, and elements from `y` elsewhere. If only `condition` is given, return the tuple ``condition.nonzero()``, the indices where `condition` is True. See Also -------- nonzero, choose Notes ----- If `x` and `y` are given and input arrays are 1-D, `where` is equivalent to:: [xv if c else yv for (c,xv,yv) in zip(condition,x,y)] Examples -------- >>> np.where([[True, False], [True, True]], ... [[1, 2], [3, 4]], ... [[9, 8], [7, 6]]) array([[1, 8], [3, 4]]) >>> np.where([[0, 1], [1, 0]]) (array([0, 1]), array([1, 0])) >>> x = np.arange(9.).reshape(3, 3) >>> np.where( x > 5 ) (array([2, 2, 2]), array([0, 1, 2])) >>> x[np.where( x > 3.0 )] # Note: result is 1D. array([ 4., 5., 6., 7., 8.]) >>> np.where(x < 5, x, -1) # Note: broadcasting. array([[ 0., 1., 2.], [ 3., 4., -1.], [-1., -1., -1.]]) Find the indices of elements of `x` that are in `goodvalues`. >>> goodvalues = [3, 4, 7] >>> ix = np.in1d(x.ravel(), goodvalues).reshape(x.shape) >>> ix array([[False, False, False], [ True, True, False], [False, True, False]], dtype=bool) >>> np.where(ix) (array([1, 1, 2]), array([0, 1, 1])) who(vardict=None) Print the Numpy arrays in the given dictionary. If there is no dictionary passed in or `vardict` is None then returns Numpy arrays in the globals() dictionary (all Numpy arrays in the namespace). Parameters ---------- vardict : dict, optional A dictionary possibly containing ndarrays. Default is globals(). Returns ------- out : None Returns 'None'. Notes ----- Prints out the name, shape, bytes and type of all of the ndarrays present in `vardict`. Examples -------- >>> a = np.arange(10) >>> b = np.ones(20) >>> np.who() Name Shape Bytes Type =========================================================== a 10 40 int32 b 20 160 float64 Upper bound on total bytes = 200 >>> d = {'x': np.arange(2.0), 'y': np.arange(3.0), 'txt': 'Some str', ... 'idx':5} >>> np.who(d) Name Shape Bytes Type =========================================================== y 3 24 float64 x 2 16 float64 Upper bound on total bytes = 40 zeros(...) zeros(shape, dtype=float, order='C') ... zeros_like(a, dtype=None, order='K', subok=True) Return an array of zeros with the same shape and type as a given array. ... DATA ALLOW_THREADS = 1 BUFSIZE = 8192 CLIP = 0 ERR_CALL = 3 ERR_DEFAULT = 521 ERR_IGNORE = 0 ERR_LOG = 5 ERR_PRINT = 4 ERR_RAISE = 2 ERR_WARN = 1 FLOATING_POINT_SUPPORT = 1 FPE_DIVIDEBYZERO = 1 FPE_INVALID = 8 FPE_OVERFLOW = 2 FPE_UNDERFLOW = 4 False_ = False Inf = inf Infinity = inf MAXDIMS = 32 NAN = nan NINF = -inf NZERO = -0.0 NaN = nan PINF = inf PZERO = 0.0 RAISE = 2 SHIFT_DIVIDEBYZERO = 0 SHIFT_INVALID = 9 SHIFT_OVERFLOW = 3 SHIFT_UNDERFLOW = 6 ScalarType = (, , , add = arccos = arccosh = arcsin = arcsinh = arctan = arctan2 = arctanh = bitwise_and = bitwise_not = bitwise_or = bitwise_xor = c_ = cast = {: at ...128'>: ceil = conj = conjugate = copysign = cos = cosh = deg2rad = degrees = divide = e = 2.718281828459045 equal = euler_gamma = 0.5772156649015329 exp = exp2 = expm1 = fabs = floor = floor_divide = fmax = fmin = fmod = frexp = greater = greater_equal = hypot = index_exp = inf = inf infty = inf invert = isfinite = isinf = isnan = ldexp = left_shift = less = less_equal = little_endian = True log = log10 = log1p = log2 = logaddexp = logaddexp2 = logical_and = logical_not = logical_or = logical_xor = maximum = mgrid = minimum = mod = modf = multiply = nan = nan nbytes = {: 0, newaxis = None nextafter = not_equal = ogrid = pi = 3.141592653589793 power = r_ = rad2deg = radians = reciprocal = remainder = right_shift = rint = s_ = sctypeDict = {0: , 1: , 2: , '... sctypes = {'complex': [, signbit = sin = sinh = spacing = sqrt = square = subtract = tan = tanh = true_divide = trunc = typeDict = {0: , 1: , 2: , 'Co... typecodes = {'All': '?bhilqpBHILQPefdgFDGSUVOMm', 'AllFloat': 'efdgFDG... VERSION 1.10.4 >>>