doc_content stringlengths 1 386k | doc_id stringlengths 5 188 |
|---|---|
numpy.ndarray.mean method ndarray.mean(axis=None, dtype=None, out=None, keepdims=False, *, where=True)
Returns the average of the array elements along given axis. Refer to numpy.mean for full documentation. See also numpy.mean
equivalent function | numpy.reference.generated.numpy.ndarray.mean |
numpy.ndarray.min method ndarray.min(axis=None, out=None, keepdims=False, initial=<no value>, where=True)
Return the minimum along a given axis. Refer to numpy.amin for full documentation. See also numpy.amin
equivalent function | numpy.reference.generated.numpy.ndarray.min |
numpy.ndarray.nbytes attribute ndarray.nbytes
Total bytes consumed by the elements of the array. Notes Does not include memory consumed by non-element attributes of the array object. Examples >>> x = np.zeros((3,5,2), dtype=np.complex128)
>>> x.nbytes
480
>>> np.prod(x.shape) * x.itemsize
480 | numpy.reference.generated.numpy.ndarray.nbytes |
numpy.ndarray.ndim attribute ndarray.ndim
Number of array dimensions. Examples >>> x = np.array([1, 2, 3])
>>> x.ndim
1
>>> y = np.zeros((2, 3, 4))
>>> y.ndim
3 | numpy.reference.generated.numpy.ndarray.ndim |
NumPy quickstart Prerequisites You’ll need to know a bit of Python. For a refresher, see the Python tutorial. To work the examples, you’ll need matplotlib installed in addition to NumPy. Learner profile This is a quick overview of arrays in NumPy. It demonstrates how n-dimensional (\(n>=2\)) arrays are represented and... | numpy.user.quickstart |
numpy.ndarray.newbyteorder method ndarray.newbyteorder(new_order='S', /)
Return the array with the same data viewed with a different byte order. Equivalent to: arr.view(arr.dtype.newbytorder(new_order))
Changes are also made in all fields and sub-arrays of the array data type. Parameters
new_orderstring, optio... | numpy.reference.generated.numpy.ndarray.newbyteorder |
numpy.ndarray.nonzero method ndarray.nonzero()
Return the indices of the elements that are non-zero. Refer to numpy.nonzero for full documentation. See also numpy.nonzero
equivalent function | numpy.reference.generated.numpy.ndarray.nonzero |
numpy.ndarray.partition method ndarray.partition(kth, axis=- 1, kind='introselect', order=None)
Rearranges the elements in the array 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 a... | numpy.reference.generated.numpy.ndarray.partition |
numpy.ndarray.prod method ndarray.prod(axis=None, dtype=None, out=None, keepdims=False, initial=1, where=True)
Return the product of the array elements over the given axis Refer to numpy.prod for full documentation. See also numpy.prod
equivalent function | numpy.reference.generated.numpy.ndarray.prod |
numpy.ndarray.ptp method ndarray.ptp(axis=None, out=None, keepdims=False)
Peak to peak (maximum - minimum) value along a given axis. Refer to numpy.ptp for full documentation. See also numpy.ptp
equivalent function | numpy.reference.generated.numpy.ndarray.ptp |
numpy.ndarray.put method ndarray.put(indices, values, mode='raise')
Set a.flat[n] = values[n] for all n in indices. Refer to numpy.put for full documentation. See also numpy.put
equivalent function | numpy.reference.generated.numpy.ndarray.put |
numpy.ndarray.ravel method ndarray.ravel([order])
Return a flattened array. Refer to numpy.ravel for full documentation. See also numpy.ravel
equivalent function ndarray.flat
a flat iterator on the array. | numpy.reference.generated.numpy.ndarray.ravel |
numpy.ndarray.real attribute ndarray.real
The real part of the array. See also numpy.real
equivalent function Examples >>> x = np.sqrt([1+0j, 0+1j])
>>> x.real
array([ 1. , 0.70710678])
>>> x.real.dtype
dtype('float64') | numpy.reference.generated.numpy.ndarray.real |
numpy.ndarray.repeat method ndarray.repeat(repeats, axis=None)
Repeat elements of an array. Refer to numpy.repeat for full documentation. See also numpy.repeat
equivalent function | numpy.reference.generated.numpy.ndarray.repeat |
numpy.ndarray.reshape method ndarray.reshape(shape, order='C')
Returns an array containing the same data with a new shape. Refer to numpy.reshape for full documentation. See also numpy.reshape
equivalent function Notes Unlike the free function numpy.reshape, this method on ndarray allows the elements of the s... | numpy.reference.generated.numpy.ndarray.reshape |
numpy.ndarray.resize method ndarray.resize(new_shape, refcheck=True)
Change shape and size of array in-place. Parameters
new_shapetuple of ints, or n ints
Shape of resized array.
refcheckbool, optional
If False, reference count will not be checked. Default is True. Returns
None
Raises
ValueError
... | numpy.reference.generated.numpy.ndarray.resize |
numpy.ndarray.round method ndarray.round(decimals=0, out=None)
Return a with each element rounded to the given number of decimals. Refer to numpy.around for full documentation. See also numpy.around
equivalent function | numpy.reference.generated.numpy.ndarray.round |
numpy.ndarray.searchsorted method ndarray.searchsorted(v, side='left', sorter=None)
Find indices where elements of v should be inserted in a to maintain order. For full documentation, see numpy.searchsorted See also numpy.searchsorted
equivalent function | numpy.reference.generated.numpy.ndarray.searchsorted |
numpy.ndarray.setfield method ndarray.setfield(val, dtype, offset=0)
Put a value into a specified place in a field defined by a data-type. Place val into a’s field defined by dtype and beginning offset bytes into the field. Parameters
valobject
Value to be placed in field.
dtypedtype object
Data-type of t... | numpy.reference.generated.numpy.ndarray.setfield |
numpy.ndarray.setflags method ndarray.setflags(write=None, align=None, uic=None)
Set array flags WRITEABLE, ALIGNED, (WRITEBACKIFCOPY and UPDATEIFCOPY), respectively. These Boolean-valued flags affect how numpy interprets the memory area used by a (see Notes below). The ALIGNED flag can only be set to True if the d... | numpy.reference.generated.numpy.ndarray.setflags |
numpy.ndarray.shape attribute ndarray.shape
Tuple of array dimensions. The shape property is usually used to get the current shape of an array, but may also be used to reshape the array in-place by assigning a tuple of array dimensions to it. As with numpy.reshape, one of the new shape dimensions can be -1, in whic... | numpy.reference.generated.numpy.ndarray.shape |
numpy.ndarray.size attribute ndarray.size
Number of elements in the array. Equal to np.prod(a.shape), i.e., the product of the array’s dimensions. Notes a.size returns a standard arbitrary precision Python integer. This may not be the case with other methods of obtaining the same value (like the suggested np.prod(a... | numpy.reference.generated.numpy.ndarray.size |
numpy.ndarray.sort method ndarray.sort(axis=- 1, kind=None, order=None)
Sort an array in-place. Refer to numpy.sort for full documentation. Parameters
axisint, optional
Axis along which to sort. Default is -1, which means sort along the last axis.
kind{‘quicksort’, ‘mergesort’, ‘heapsort’, ‘stable’}, option... | numpy.reference.generated.numpy.ndarray.sort |
numpy.ndarray.squeeze method ndarray.squeeze(axis=None)
Remove axes of length one from a. Refer to numpy.squeeze for full documentation. See also numpy.squeeze
equivalent function | numpy.reference.generated.numpy.ndarray.squeeze |
numpy.ndarray.std method ndarray.std(axis=None, dtype=None, out=None, ddof=0, keepdims=False, *, where=True)
Returns the standard deviation of the array elements along given axis. Refer to numpy.std for full documentation. See also numpy.std
equivalent function | numpy.reference.generated.numpy.ndarray.std |
numpy.ndarray.strides attribute ndarray.strides
Tuple of bytes to step in each dimension when traversing an array. The byte offset of element (i[0], i[1], ..., i[n]) in an array a is: offset = sum(np.array(i) * a.strides)
A more detailed explanation of strides can be found in the “ndarray.rst” file in the NumPy re... | numpy.reference.generated.numpy.ndarray.strides |
numpy.ndarray.sum method ndarray.sum(axis=None, dtype=None, out=None, keepdims=False, initial=0, where=True)
Return the sum of the array elements over the given axis. Refer to numpy.sum for full documentation. See also numpy.sum
equivalent function | numpy.reference.generated.numpy.ndarray.sum |
numpy.ndarray.swapaxes method ndarray.swapaxes(axis1, axis2)
Return a view of the array with axis1 and axis2 interchanged. Refer to numpy.swapaxes for full documentation. See also numpy.swapaxes
equivalent function | numpy.reference.generated.numpy.ndarray.swapaxes |
numpy.ndarray.T attribute ndarray.T
The transposed array. Same as self.transpose(). See also transpose
Examples >>> x = np.array([[1.,2.],[3.,4.]])
>>> x
array([[ 1., 2.],
[ 3., 4.]])
>>> x.T
array([[ 1., 3.],
[ 2., 4.]])
>>> x = np.array([1.,2.,3.,4.])
>>> x
array([ 1., 2., 3., 4.])
>>> x.... | numpy.reference.generated.numpy.ndarray.t |
numpy.ndarray.take method ndarray.take(indices, axis=None, out=None, mode='raise')
Return an array formed from the elements of a at the given indices. Refer to numpy.take for full documentation. See also numpy.take
equivalent function | numpy.reference.generated.numpy.ndarray.take |
numpy.ndarray.tobytes method ndarray.tobytes(order='C')
Construct Python bytes containing the raw data bytes in the array. Constructs Python bytes showing a copy of the raw contents of data memory. The bytes object is produced in C-order by default. This behavior is controlled by the order parameter. New in versio... | numpy.reference.generated.numpy.ndarray.tobytes |
numpy.ndarray.tofile method ndarray.tofile(fid, sep='', format='%s')
Write array to a file as text or binary (default). Data is always written in ‘C’ order, independent of the order of a. The data produced by this method can be recovered using the function fromfile(). Parameters
fidfile or str or Path
An open... | numpy.reference.generated.numpy.ndarray.tofile |
numpy.ndarray.tolist method ndarray.tolist()
Return the array as an a.ndim-levels deep nested list of Python scalars. Return a copy of the array data as a (nested) Python list. Data items are converted to the nearest compatible builtin Python type, via the item function. If a.ndim is 0, then since the depth of the ... | numpy.reference.generated.numpy.ndarray.tolist |
numpy.ndarray.tostring method ndarray.tostring(order='C')
A compatibility alias for tobytes, with exactly the same behavior. Despite its name, it returns bytes not strs. Deprecated since version 1.19.0. | numpy.reference.generated.numpy.ndarray.tostring |
numpy.ndarray.trace method ndarray.trace(offset=0, axis1=0, axis2=1, dtype=None, out=None)
Return the sum along diagonals of the array. Refer to numpy.trace for full documentation. See also numpy.trace
equivalent function | numpy.reference.generated.numpy.ndarray.trace |
numpy.ndarray.transpose method ndarray.transpose(*axes)
Returns a view of the array with axes transposed. For a 1-D array this has no effect, as a transposed vector is simply the same vector. To convert a 1-D array into a 2D column vector, an additional dimension must be added. np.atleast2d(a).T achieves this, as d... | numpy.reference.generated.numpy.ndarray.transpose |
numpy.ndarray.var method ndarray.var(axis=None, dtype=None, out=None, ddof=0, keepdims=False, *, where=True)
Returns the variance of the array elements, along given axis. Refer to numpy.var for full documentation. See also numpy.var
equivalent function | numpy.reference.generated.numpy.ndarray.var |
numpy.ndarray.view method ndarray.view([dtype][, type])
New view of array with the same data. Note Passing None for dtype is different from omitting the parameter, since the former invokes dtype(None) which is an alias for dtype('float_'). Parameters
dtypedata-type or ndarray sub-class, optional
Data-type d... | numpy.reference.generated.numpy.ndarray.view |
numpy.ndindex.ndincr method ndindex.ndincr()[source]
Increment the multi-dimensional index by one. This method is for backward compatibility only: do not use. Deprecated since version 1.20.0: This method has been advised against since numpy 1.8.0, but only started emitting DeprecationWarning as of this version. | numpy.reference.generated.numpy.ndindex.ndincr |
numpy.nditer.close method nditer.close()
Resolve all writeback semantics in writeable operands. New in version 1.15.0. See also Modifying Array Values | numpy.reference.generated.numpy.nditer.close |
numpy.nditer.copy method nditer.copy()
Get a copy of the iterator in its current state. Examples >>> x = np.arange(10)
>>> y = x + 1
>>> it = np.nditer([x, y])
>>> next(it)
(array(0), array(1))
>>> it2 = it.copy()
>>> next(it2)
(array(1), array(2)) | numpy.reference.generated.numpy.nditer.copy |
numpy.nditer.debug_print method nditer.debug_print()
Print the current state of the nditer instance and debug info to stdout. | numpy.reference.generated.numpy.nditer.debug_print |
numpy.nditer.enable_external_loop method nditer.enable_external_loop()
When the “external_loop” was not used during construction, but is desired, this modifies the iterator to behave as if the flag was specified. | numpy.reference.generated.numpy.nditer.enable_external_loop |
numpy.nditer.index attribute nditer.index | numpy.reference.generated.numpy.nditer.index |
numpy.nditer.iternext method nditer.iternext()
Check whether iterations are left, and perform a single internal iteration without returning the result. Used in the C-style pattern do-while pattern. For an example, see nditer. Returns
iternextbool
Whether or not there are iterations left. | numpy.reference.generated.numpy.nditer.iternext |
numpy.nditer.itersize attribute nditer.itersize | numpy.reference.generated.numpy.nditer.itersize |
numpy.nditer.multi_index attribute nditer.multi_index | numpy.reference.generated.numpy.nditer.multi_index |
numpy.nditer.operands attribute nditer.operands
operands[Slice] The array(s) to be iterated over. Valid only before the iterator is closed. | numpy.reference.generated.numpy.nditer.operands |
numpy.nditer.remove_axis method nditer.remove_axis(i, /)
Removes axis i from the iterator. Requires that the flag “multi_index” be enabled. | numpy.reference.generated.numpy.nditer.remove_axis |
numpy.nditer.remove_multi_index method nditer.remove_multi_index()
When the “multi_index” flag was specified, this removes it, allowing the internal iteration structure to be optimized further. | numpy.reference.generated.numpy.nditer.remove_multi_index |
numpy.nditer.reset method nditer.reset()
Reset the iterator to its initial state. | numpy.reference.generated.numpy.nditer.reset |
numpy.nditer.value attribute nditer.value | numpy.reference.generated.numpy.nditer.value |
Using Python as glue Many people like to say that Python is a fantastic glue language. Hopefully, this Chapter will convince you that this is true. The first adopters of Python for science were typically people who used it to glue together large application codes running on super-computers. Not only was it much nicer t... | numpy.user.c-info.python-as-glue |
numpy.number.__class_getitem__ method number.__class_getitem__(item, /)
Return a parametrized wrapper around the number type. New in version 1.22. Returns
aliastypes.GenericAlias
A parametrized number type. See also PEP 585
Type hinting generics in standard collections. Notes This method is only a... | numpy.reference.generated.numpy.number.__class_getitem__ |
numpy.absolute numpy.absolute(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = <ufunc 'absolute'>
Calculate the absolute value element-wise. np.abs is a shorthand for this function. Parameters
xarray_like
Input array.
outndarray, None, or tuple of... | numpy.reference.generated.numpy.absolute |
numpy.add numpy.add(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = <ufunc 'add'>
Add arguments element-wise. Parameters
x1, x2array_like
The arrays to be added. If x1.shape != x2.shape, they must be broadcastable to a common shape (which beco... | numpy.reference.generated.numpy.add |
numpy.all numpy.all(a, axis=None, out=None, keepdims=<no value>, *, where=<no value>)[source]
Test whether all array elements along a given axis evaluate to True. Parameters
aarray_like
Input array or object that can be converted to an array.
axisNone or int or tuple of ints, optional
Axis or axes along w... | numpy.reference.generated.numpy.all |
numpy.allclose numpy.allclose(a, b, rtol=1e-05, atol=1e-08, equal_nan=False)[source]
Returns True if two arrays are element-wise equal within a tolerance. The tolerance values are positive, typically very small numbers. The relative difference (rtol * abs(b)) and the absolute difference atol are added together to c... | numpy.reference.generated.numpy.allclose |
numpy.amax numpy.amax(a, axis=None, out=None, keepdims=<no value>, initial=<no value>, where=<no value>)[source]
Return the maximum of an array or maximum along an axis. Parameters
aarray_like
Input data.
axisNone or int or tuple of ints, optional
Axis or axes along which to operate. By default, flattened... | numpy.reference.generated.numpy.amax |
numpy.amin numpy.amin(a, axis=None, out=None, keepdims=<no value>, initial=<no value>, where=<no value>)[source]
Return the minimum of an array or minimum along an axis. Parameters
aarray_like
Input data.
axisNone or int or tuple of ints, optional
Axis or axes along which to operate. By default, flattened... | numpy.reference.generated.numpy.amin |
numpy.angle numpy.angle(z, deg=False)[source]
Return the angle of the complex argument. Parameters
zarray_like
A complex number or sequence of complex numbers.
degbool, optional
Return angle in degrees if True, radians if False (default). Returns
anglendarray or scalar
The counterclockwise angle f... | numpy.reference.generated.numpy.angle |
numpy.any numpy.any(a, axis=None, out=None, keepdims=<no value>, *, where=<no value>)[source]
Test whether any array element along a given axis evaluates to True. Returns single boolean unless axis is not None Parameters
aarray_like
Input array or object that can be converted to an array.
axisNone or int or... | numpy.reference.generated.numpy.any |
numpy.append numpy.append(arr, values, axis=None)[source]
Append values to the end of an array. Parameters
arrarray_like
Values are appended to a copy of this array.
valuesarray_like
These values are appended to a copy of arr. It must be of the correct shape (the same shape as arr, excluding axis). If axi... | numpy.reference.generated.numpy.append |
numpy.apply_along_axis numpy.apply_along_axis(func1d, axis, arr, *args, **kwargs)[source]
Apply a function to 1-D slices along the given axis. Execute func1d(a, *args, **kwargs) where func1d operates on 1-D arrays and a is a 1-D slice of arr along axis. This is equivalent to (but faster than) the following use of n... | numpy.reference.generated.numpy.apply_along_axis |
numpy.apply_over_axes numpy.apply_over_axes(func, a, axes)[source]
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 ... | numpy.reference.generated.numpy.apply_over_axes |
numpy.arange numpy.arange([start, ]stop, [step, ]dtype=None, *, like=None)
Return evenly spaced values within a given interval. Values are generated within the half-open interval [start, stop) (in other words, the interval including start but excluding stop). For integer arguments the function is equivalent to the ... | numpy.reference.generated.numpy.arange |
numpy.arccos numpy.arccos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = <ufunc 'arccos'>
Trigonometric inverse cosine, element-wise. The inverse of cos so that, if y = cos(x), then x = arccos(y). Parameters
xarray_like
x-coordinate on the unit ci... | numpy.reference.generated.numpy.arccos |
numpy.arccosh numpy.arccosh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = <ufunc 'arccosh'>
Inverse hyperbolic cosine, element-wise. Parameters
xarray_like
Input array.
outndarray, None, or tuple of ndarray and None, optional
A location into ... | numpy.reference.generated.numpy.arccosh |
numpy.arcsin numpy.arcsin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = <ufunc 'arcsin'>
Inverse sine, element-wise. Parameters
xarray_like
y-coordinate on the unit circle.
outndarray, None, or tuple of ndarray and None, optional
A location i... | numpy.reference.generated.numpy.arcsin |
numpy.arcsinh numpy.arcsinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = <ufunc 'arcsinh'>
Inverse hyperbolic sine element-wise. Parameters
xarray_like
Input array.
outndarray, None, or tuple of ndarray and None, optional
A location into whi... | numpy.reference.generated.numpy.arcsinh |
numpy.arctan numpy.arctan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = <ufunc 'arctan'>
Trigonometric inverse tangent, element-wise. The inverse of tan, so that if y = tan(x) then x = arctan(y). Parameters
xarray_like
outndarray, None, or tuple ... | numpy.reference.generated.numpy.arctan |
numpy.arctan2 numpy.arctan2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = <ufunc 'arctan2'>
Element-wise arc tangent of x1/x2 choosing the quadrant correctly. The quadrant (i.e., branch) is chosen so that arctan2(x1, x2) is the signed angle in rad... | numpy.reference.generated.numpy.arctan2 |
numpy.arctanh numpy.arctanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = <ufunc 'arctanh'>
Inverse hyperbolic tangent element-wise. Parameters
xarray_like
Input array.
outndarray, None, or tuple of ndarray and None, optional
A location into ... | numpy.reference.generated.numpy.arctanh |
numpy.argmax numpy.argmax(a, axis=None, out=None, *, keepdims=<no value>)[source]
Returns the indices of the maximum values along an axis. Parameters
aarray_like
Input array.
axisint, optional
By default, the index is into the flattened array, otherwise along the specified axis.
outarray, optional
If ... | numpy.reference.generated.numpy.argmax |
numpy.argmin numpy.argmin(a, axis=None, out=None, *, keepdims=<no value>)[source]
Returns the indices of the minimum values along an axis. Parameters
aarray_like
Input array.
axisint, optional
By default, the index is into the flattened array, otherwise along the specified axis.
outarray, optional
If ... | numpy.reference.generated.numpy.argmin |
numpy.argpartition numpy.argpartition(a, kth, axis=- 1, kind='introselect', order=None)[source]
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. New ... | numpy.reference.generated.numpy.argpartition |
numpy.argsort numpy.argsort(a, axis=- 1, kind=None, order=None)[source]
Returns the indices that would sort an array. Perform an indirect sort 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 sorted ... | numpy.reference.generated.numpy.argsort |
numpy.argwhere numpy.argwhere(a)[source]
Find the indices of array elements that are non-zero, grouped by element. Parameters
aarray_like
Input data. Returns
index_array(N, a.ndim) ndarray
Indices of elements that are non-zero. Indices are grouped by element. This array will have shape (N, a.ndim) whe... | numpy.reference.generated.numpy.argwhere |
numpy.around numpy.around(a, decimals=0, out=None)[source]
Evenly round to the given number of decimals. Parameters
aarray_like
Input data.
decimalsint, optional
Number of decimal places to round to (default: 0). If decimals is negative, it specifies the number of positions to the left of the decimal poin... | numpy.reference.generated.numpy.around |
numpy.array numpy.array(object, dtype=None, *, copy=True, order='K', subok=False, ndmin=0, like=None)
Create an array. Parameters
objectarray_like
An array, any object exposing the array interface, an object whose __array__ method returns an array, or any (nested) sequence. If object is a scalar, a 0-dimensio... | numpy.reference.generated.numpy.array |
numpy.array2string numpy.array2string(a, max_line_width=None, precision=None, suppress_small=None, separator=' ', prefix='', style=<no value>, formatter=None, threshold=None, edgeitems=None, sign=None, floatmode=None, suffix='', *, legacy=None)[source]
Return a string representation of an array. Parameters
anda... | numpy.reference.generated.numpy.array2string |
numpy.array_equal numpy.array_equal(a1, a2, equal_nan=False)[source]
True if two arrays have the same shape and elements, False otherwise. Parameters
a1, a2array_like
Input arrays.
equal_nanbool
Whether to compare NaN’s as equal. If the dtype of a1 and a2 is complex, values will be considered equal if eit... | numpy.reference.generated.numpy.array_equal |
numpy.array_equiv numpy.array_equiv(a1, a2)[source]
Returns True if input arrays are shape consistent and all elements equal. Shape consistent means they are either the same shape, or one input array can be broadcasted to create the same shape as the other one. Parameters
a1, a2array_like
Input arrays. Ret... | numpy.reference.generated.numpy.array_equiv |
numpy.array_repr numpy.array_repr(arr, max_line_width=None, precision=None, suppress_small=None)[source]
Return the string representation of an array. Parameters
arrndarray
Input array.
max_line_widthint, optional
Inserts newlines if text is longer than max_line_width. Defaults to numpy.get_printoptions()... | numpy.reference.generated.numpy.array_repr |
numpy.array_split numpy.array_split(ary, indices_or_sections, axis=0)[source]
Split an array into multiple sub-arrays. Please refer to the split documentation. The only difference between these functions is that array_split allows indices_or_sections to be an integer that does not equally divide the axis. For an ar... | numpy.reference.generated.numpy.array_split |
numpy.array_str numpy.array_str(a, max_line_width=None, precision=None, suppress_small=None)[source]
Return a string representation of the data in an array. The data in the array is returned as a single string. This function is similar to array_repr, the difference being that array_repr also returns information on ... | numpy.reference.generated.numpy.array_str |
numpy.asanyarray numpy.asanyarray(a, dtype=None, order=None, *, like=None)
Convert the input to an ndarray, but pass ndarray subclasses through. Parameters
aarray_like
Input data, in any form that can be converted to an array. This includes scalars, lists, lists of tuples, tuples, tuples of tuples, tuples of ... | numpy.reference.generated.numpy.asanyarray |
numpy.asarray numpy.asarray(a, dtype=None, order=None, *, like=None)
Convert the input to an array. Parameters
aarray_like
Input data, in any form that can be converted to an array. This includes lists, lists of tuples, tuples, tuples of tuples, tuples of lists and ndarrays.
dtypedata-type, optional
By de... | numpy.reference.generated.numpy.asarray |
numpy.asarray_chkfinite numpy.asarray_chkfinite(a, dtype=None, order=None)[source]
Convert the input to an array, checking for NaNs or Infs. Parameters
aarray_like
Input data, in any form that can be converted to an array. This includes lists, lists of tuples, tuples, tuples of tuples, tuples of lists and nda... | numpy.reference.generated.numpy.asarray_chkfinite |
numpy.ascontiguousarray numpy.ascontiguousarray(a, dtype=None, *, like=None)
Return a contiguous array (ndim >= 1) in memory (C order). Parameters
aarray_like
Input array.
dtypestr or dtype object, optional
Data-type of returned array.
likearray_like
Reference object to allow the creation of arrays wh... | numpy.reference.generated.numpy.ascontiguousarray |
numpy.asfarray numpy.asfarray(a, dtype=<class 'numpy.double'>)[source]
Return an array converted to a float type. Parameters
aarray_like
The input array.
dtypestr or dtype object, optional
Float type code to coerce input array a. If dtype is one of the ‘int’ dtypes, it is replaced with float64. Returns... | numpy.reference.generated.numpy.asfarray |
numpy.asfortranarray numpy.asfortranarray(a, dtype=None, *, like=None)
Return an array (ndim >= 1) laid out in Fortran order in memory. Parameters
aarray_like
Input array.
dtypestr or dtype object, optional
By default, the data-type is inferred from the input data.
likearray_like
Reference object to a... | numpy.reference.generated.numpy.asfortranarray |
numpy.asmatrix numpy.asmatrix(data, dtype=None)[source]
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
dataarray_like
Input data.
dtypedata-type
Data-type of the output matrix.... | numpy.reference.generated.numpy.asmatrix |
numpy.asscalar numpy.asscalar(a)[source]
Convert an array of size 1 to its scalar equivalent. Deprecated since version 1.16: Deprecated, use numpy.ndarray.item() instead. Parameters
andarray
Input array of size 1. Returns
outscalar
Scalar representation of a. The output data type is the same type re... | numpy.reference.generated.numpy.asscalar |
numpy.atleast_1d numpy.atleast_1d(*arys)[source]
Convert inputs to arrays with at least one dimension. Scalar inputs are converted to 1-dimensional arrays, whilst higher-dimensional inputs are preserved. Parameters
arys1, arys2, …array_like
One or more input arrays. Returns
retndarray
An array, or lis... | numpy.reference.generated.numpy.atleast_1d |
numpy.atleast_2d numpy.atleast_2d(*arys)[source]
View inputs as arrays with at least two dimensions. Parameters
arys1, arys2, …array_like
One or more array-like sequences. Non-array inputs are converted to arrays. Arrays that already have two or more dimensions are preserved. Returns
res, res2, …ndarray... | numpy.reference.generated.numpy.atleast_2d |
numpy.atleast_3d numpy.atleast_3d(*arys)[source]
View inputs as arrays with at least three dimensions. Parameters
arys1, arys2, …array_like
One or more array-like sequences. Non-array inputs are converted to arrays. Arrays that already have three or more dimensions are preserved. Returns
res1, res2, …nd... | numpy.reference.generated.numpy.atleast_3d |
numpy.average numpy.average(a, axis=None, weights=None, returned=False)[source]
Compute the weighted average along the specified axis. Parameters
aarray_like
Array containing data to be averaged. If a is not an array, a conversion is attempted.
axisNone or int or tuple of ints, optional
Axis or axes along... | numpy.reference.generated.numpy.average |
numpy.AxisError exception numpy.AxisError(axis, ndim=None, msg_prefix=None)[source]
Axis supplied was invalid. This is raised whenever an axis parameter is specified that is larger than the number of array dimensions. For compatibility with code written against older numpy versions, which raised a mixture of ValueE... | numpy.reference.generated.numpy.axiserror |
numpy.bartlett numpy.bartlett(M)[source]
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. Parameters
Mint
Numb... | numpy.reference.generated.numpy.bartlett |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.