doc_content
stringlengths
1
386k
doc_id
stringlengths
5
188
numpy.r_ numpy.r_ = <numpy.lib.index_tricks.RClass object> Translates slice objects to concatenation along the first axis. This is a simple way to build up arrays quickly. There are two use cases. If the index expression contains comma separated arrays, then stack them along their first axis. If the index expressi...
numpy.reference.generated.numpy.r_
numpy.rad2deg numpy.rad2deg(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = <ufunc 'rad2deg'> Convert angles from radians to degrees. Parameters xarray_like Angle in radians. outndarray, None, or tuple of ndarray and None, optional A location i...
numpy.reference.generated.numpy.rad2deg
numpy.radians numpy.radians(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = <ufunc 'radians'> Convert angles from degrees to radians. Parameters xarray_like Input array in degrees. outndarray, None, or tuple of ndarray and None, optional A loca...
numpy.reference.generated.numpy.radians
numpy.random.BitGenerator class numpy.random.BitGenerator(seed=None) Base Class for generic BitGenerators, which provide a stream of random bits based on different algorithms. Must be overridden. Parameters seed{None, int, array_like[ints], SeedSequence}, optional A seed to initialize the BitGenerator. If Non...
numpy.reference.random.bit_generators.generated.numpy.random.bitgenerator
Random Generator The Generator provides access to a wide range of distributions, and served as a replacement for RandomState. The main difference between the two is that Generator relies on an additional BitGenerator to manage state and generate the random bits, which are then transformed into random values from useful...
numpy.reference.random.generator
class numpy.random.Generator(bit_generator) Container for the BitGenerators. Generator exposes a number of methods for generating random numbers drawn from a variety of probability distributions. In addition to the distribution-specific arguments, each method takes a keyword argument size that defaults to None. If si...
numpy.reference.random.generator#numpy.random.Generator
Mersenne Twister (MT19937) class numpy.random.MT19937(seed=None) Container for the Mersenne Twister pseudo-random number generator. Parameters seed{None, int, array_like[ints], SeedSequence}, optional A seed to initialize the BitGenerator. If None, then fresh, unpredictable entropy will be pulled from the OS....
numpy.reference.random.bit_generators.mt19937
Permuted Congruential Generator (64-bit, PCG64) class numpy.random.PCG64(seed=None) BitGenerator for the PCG-64 pseudo-random number generator. Parameters seed{None, int, array_like[ints], SeedSequence}, optional A seed to initialize the BitGenerator. If None, then fresh, unpredictable entropy will be pulled ...
numpy.reference.random.bit_generators.pcg64
Permuted Congruential Generator (64-bit, PCG64 DXSM) class numpy.random.PCG64DXSM(seed=None) BitGenerator for the PCG-64 DXSM pseudo-random number generator. Parameters seed{None, int, array_like[ints], SeedSequence}, optional A seed to initialize the BitGenerator. If None, then fresh, unpredictable entropy w...
numpy.reference.random.bit_generators.pcg64dxsm
Philox Counter-based RNG class numpy.random.Philox(seed=None, counter=None, key=None) Container for the Philox (4x64) pseudo-random number generator. Parameters seed{None, int, array_like[ints], SeedSequence}, optional A seed to initialize the BitGenerator. If None, then fresh, unpredictable entropy will be p...
numpy.reference.random.bit_generators.philox
Legacy Random Generation The RandomState provides access to legacy generators. This generator is considered frozen and will have no further improvements. It is guaranteed to produce the same values as the final point release of NumPy v1.16. These all depend on Box-Muller normals or inverse CDF exponentials or gammas. T...
numpy.reference.random.legacy
numpy.random.SeedSequence class numpy.random.SeedSequence(entropy=None, *, spawn_key=(), pool_size=4) SeedSequence mixes sources of entropy in a reproducible way to set the initial state for independent and very probably non-overlapping BitGenerators. Once the SeedSequence is instantiated, you can call the generate...
numpy.reference.random.bit_generators.generated.numpy.random.seedsequence
SFC64 Small Fast Chaotic PRNG class numpy.random.SFC64(seed=None) BitGenerator for Chris Doty-Humphrey’s Small Fast Chaotic PRNG. Parameters seed{None, int, array_like[ints], SeedSequence}, optional A seed to initialize the BitGenerator. If None, then fresh, unpredictable entropy will be pulled from the OS. I...
numpy.reference.random.bit_generators.sfc64
numpy.RankWarning exception numpy.RankWarning[source] Issued by polyfit when the Vandermonde matrix is rank deficient. For more information, a way to suppress the warning, and an example of RankWarning being issued, see polyfit.
numpy.reference.generated.numpy.rankwarning
numpy.ravel numpy.ravel(a, order='C')[source] Return a contiguous flattened array. A 1-D array, containing the elements of the input, is returned. A copy is made only if needed. As of NumPy 1.10, the returned array will have the same type as the input array. (for example, a masked array will be returned for a maske...
numpy.reference.generated.numpy.ravel
numpy.ravel_multi_index numpy.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. Parameters multi_indextuple of array_like A tuple of integer arrays, one array for each dimension. dimstuple...
numpy.reference.generated.numpy.ravel_multi_index
numpy.real numpy.real(val)[source] Return the real part of the complex argument. Parameters valarray_like Input array. Returns outndarray or scalar The real component of the complex argument. If val is real, the type of val is used for the output. If val has complex elements, the returned type is floa...
numpy.reference.generated.numpy.real
numpy.real_if_close numpy.real_if_close(a, tol=100)[source] If input is complex with all imaginary parts close to zero, return real parts. “Close to zero” is defined as tol * (machine epsilon of the type for a). Parameters aarray_like Input array. tolfloat Tolerance in machine epsilons for the complex par...
numpy.reference.generated.numpy.real_if_close
numpy.recarray class numpy.recarray(shape, dtype=None, buf=None, offset=0, strides=None, formats=None, names=None, titles=None, byteorder=None, aligned=False, order='C')[source] Construct an ndarray that allows field access using attributes. Arrays may have a data-types containing fields, analogous to columns in a ...
numpy.reference.generated.numpy.recarray
numpy.reciprocal numpy.reciprocal(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = <ufunc 'reciprocal'> Return the reciprocal of the argument, element-wise. Calculates 1/x. Parameters xarray_like Input array. outndarray, None, or tuple of ndarray ...
numpy.reference.generated.numpy.reciprocal
numpy.record class numpy.record[source] A data-type scalar that allows field access as attribute lookup. Attributes T Scalar attribute identical to the corresponding array attribute. base base object data Pointer to start of data. dtype dtype object flags integer value of flags flat A 1-D view of the ...
numpy.reference.generated.numpy.record
numpy.remainder numpy.remainder(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = <ufunc 'remainder'> Returns the element-wise remainder of division. Computes the remainder complementary to the floor_divide function. It is equivalent to the Python mod...
numpy.reference.generated.numpy.remainder
numpy.repeat numpy.repeat(a, repeats, axis=None)[source] Repeat elements of an array. Parameters aarray_like Input array. repeatsint or array of ints The number of repetitions for each element. repeats is broadcasted to fit the shape of the given axis. axisint, optional The axis along which to repeat ...
numpy.reference.generated.numpy.repeat
numpy.require numpy.require(a, dtype=None, requirements=None, *, like=None)[source] 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). Parameters aarray_lik...
numpy.reference.generated.numpy.require
numpy.reshape numpy.reshape(a, newshape, order='C')[source] Gives a new shape to an array without changing its data. Parameters aarray_like Array to be reshaped. newshapeint or tuple of ints The new shape should be compatible with the original shape. If an integer, then the result will be a 1-D array of t...
numpy.reference.generated.numpy.reshape
numpy.resize numpy.resize(a, new_shape)[source] Return a new array with the specified shape. If the new array is larger than the original array, then the new array is filled with repeated copies of a. Note that this behavior is different from a.resize(new_shape) which fills with zeros instead of repeated copies of ...
numpy.reference.generated.numpy.resize
numpy.result_type numpy.result_type(*arrays_and_dtypes) Returns the type that results from applying the NumPy type promotion rules to the arguments. Type promotion in NumPy works similarly to the rules in languages like C++, with some slight differences. When both scalars and arrays are used, the array’s type takes...
numpy.reference.generated.numpy.result_type
numpy.right_shift numpy.right_shift(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = <ufunc 'right_shift'> Shift the bits of an integer to the right. Bits are shifted to the right x2. Because the internal representation of numbers is in binary format...
numpy.reference.generated.numpy.right_shift
numpy.rint numpy.rint(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = <ufunc 'rint'> Round elements of the array to the nearest integer. Parameters xarray_like Input array. outndarray, None, or tuple of ndarray and None, optional A location int...
numpy.reference.generated.numpy.rint
numpy.roll numpy.roll(a, shift, axis=None)[source] Roll array elements along a given axis. Elements that roll beyond the last position are re-introduced at the first. Parameters aarray_like Input array. shiftint or tuple of ints The number of places by which elements are shifted. If a tuple, then axis mus...
numpy.reference.generated.numpy.roll
numpy.rollaxis numpy.rollaxis(a, axis, start=0)[source] Roll the specified axis backwards, until it lies in a given position. This function continues to be supported for backward compatibility, but you should prefer moveaxis. The moveaxis function was added in NumPy 1.11. Parameters andarray Input array. ax...
numpy.reference.generated.numpy.rollaxis
numpy.roots numpy.roots(p)[source] Return the roots of a polynomial with coefficients given in p. Note This forms part of the old polynomial API. Since version 1.4, the new polynomial API defined in numpy.polynomial is preferred. A summary of the differences can be found in the transition guide. The values in the...
numpy.reference.generated.numpy.roots
numpy.rot90 numpy.rot90(m, k=1, axes=(0, 1))[source] Rotate an array by 90 degrees in the plane specified by axes. Rotation direction is from the first towards the second axis. Parameters marray_like Array of two or more dimensions. kinteger Number of times the array is rotated by 90 degrees. axes: (2,) ...
numpy.reference.generated.numpy.rot90
numpy.round_ numpy.round_(a, decimals=0, out=None)[source] Round an array to the given number of decimals. See also around equivalent function; see for details.
numpy.reference.generated.numpy.round_
numpy.row_stack numpy.row_stack(tup)[source] Stack arrays in sequence vertically (row wise). This is equivalent to concatenation along the first axis after 1-D arrays of shape (N,) have been reshaped to (1,N). Rebuilds arrays divided by vsplit. This function makes most sense for arrays with up to 3 dimensions. For ...
numpy.reference.generated.numpy.row_stack
numpy.s_ numpy.s_ = <numpy.lib.index_tricks.IndexExpression object> A nicer way to build up index tuples for arrays. Note Use one of the two predefined instances index_exp or s_ rather than directly using IndexExpression. For any index combination, including slicing and axis insertion, a[indices] is the same as a...
numpy.reference.generated.numpy.s_
numpy.save numpy.save(file, arr, allow_pickle=True, fix_imports=True)[source] Save an array to a binary file in NumPy .npy format. Parameters filefile, str, or pathlib.Path File or filename to which the data is saved. If file is a file-object, then the filename is unchanged. If file is a string or Path, a .np...
numpy.reference.generated.numpy.save
numpy.savetxt numpy.savetxt(fname, X, fmt='%.18e', delimiter=' ', newline='\n', header='', footer='', comments='# ', encoding=None)[source] Save an array to a text file. Parameters fnamefilename or file handle If the filename ends in .gz, the file is automatically saved in compressed gzip format. loadtxt unde...
numpy.reference.generated.numpy.savetxt
numpy.savez numpy.savez(file, *args, **kwds)[source] Save several arrays into a single file in uncompressed .npz format. Provide arrays as keyword arguments to store them under the corresponding name in the output file: savez(fn, x=x, y=y). If arrays are specified as positional arguments, i.e., savez(fn, x, y), the...
numpy.reference.generated.numpy.savez
numpy.savez_compressed numpy.savez_compressed(file, *args, **kwds)[source] Save several arrays into a single file in compressed .npz format. Provide arrays as keyword arguments to store them under the corresponding name in the output file: savez(fn, x=x, y=y). If arrays are specified as positional arguments, i.e., ...
numpy.reference.generated.numpy.savez_compressed
numpy.sctype2char numpy.sctype2char(sctype)[source] Return the string representation of a scalar dtype. Parameters sctypescalar dtype or object If a scalar dtype, the corresponding string character is returned. If an object, sctype2char tries to infer its scalar type and then return the corresponding string c...
numpy.reference.generated.numpy.sctype2char
numpy.searchsorted numpy.searchsorted(a, v, side='left', sorter=None)[source] 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. Assuming that a is...
numpy.reference.generated.numpy.searchsorted
numpy.select numpy.select(condlist, choicelist, default=0)[source] Return an array drawn from elements in choicelist, depending on conditions. Parameters condlistlist of bool ndarrays The list of conditions which determine from which array in choicelist the output elements are taken. When multiple conditions ...
numpy.reference.generated.numpy.select
numpy.set_printoptions numpy.set_printoptions(precision=None, threshold=None, edgeitems=None, linewidth=None, suppress=None, nanstr=None, infstr=None, formatter=None, sign=None, floatmode=None, *, legacy=None)[source] Set printing options. These options determine the way floating point numbers, arrays and other Num...
numpy.reference.generated.numpy.set_printoptions
numpy.set_string_function numpy.set_string_function(f, repr=True)[source] Set a Python function to be used when pretty printing arrays. Parameters ffunction or None Function to be used to pretty print arrays. The function should expect a single array argument and return a string of the representation of the a...
numpy.reference.generated.numpy.set_string_function
numpy.setbufsize numpy.setbufsize(size)[source] Set the size of the buffer used in ufuncs. Parameters sizeint Size of buffer.
numpy.reference.generated.numpy.setbufsize
numpy.setdiff1d numpy.setdiff1d(ar1, ar2, assume_unique=False)[source] Find the set difference of two arrays. Return the unique values in ar1 that are not in ar2. Parameters ar1array_like Input array. ar2array_like Input comparison array. assume_uniquebool If True, the input arrays are both assumed to...
numpy.reference.generated.numpy.setdiff1d
numpy.seterr numpy.seterr(all=None, divide=None, over=None, under=None, invalid=None)[source] Set how floating-point errors are handled. Note that operations on integer scalar types (such as int16) are handled like floating point, and are affected by these settings. Parameters all{‘ignore’, ‘warn’, ‘raise’, ‘ca...
numpy.reference.generated.numpy.seterr
numpy.seterrcall numpy.seterrcall(func)[source] 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...
numpy.reference.generated.numpy.seterrcall
numpy.seterrobj numpy.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). Parameters ...
numpy.reference.generated.numpy.seterrobj
numpy.setxor1d numpy.setxor1d(ar1, ar2, assume_unique=False)[source] Find the set exclusive-or of two arrays. Return the sorted, unique values that are in only one (not both) of the input arrays. Parameters ar1, ar2array_like Input arrays. assume_uniquebool If True, the input arrays are both assumed to be...
numpy.reference.generated.numpy.setxor1d
numpy.shape numpy.shape(a)[source] Return the shape of an array. Parameters aarray_like Input array. Returns shapetuple of ints The elements of the shape tuple give the lengths of the corresponding array dimensions. See also len ndarray.shape Equivalent array method. Examples >>> np.shape(np...
numpy.reference.generated.numpy.shape
numpy.shares_memory numpy.shares_memory(a, b, /, max_work=None) Determine if two arrays share memory. Warning This function can be exponentially slow for some inputs, unless max_work is set to a finite number or MAY_SHARE_BOUNDS. If in doubt, use numpy.may_share_memory instead. Parameters a, bndarray Input ...
numpy.reference.generated.numpy.shares_memory
class numpy.short[source] Signed integer type, compatible with C short. Character code 'h' Alias on this platform (Linux x86_64) numpy.int16: 16-bit signed integer (-32_768 to 32_767).
numpy.reference.arrays.scalars#numpy.short
numpy.show_config numpy.show_config()[source] Show libraries in the system on which NumPy was built. Print information about various resources (libraries, library directories, include directories, etc.) in the system on which NumPy was built. See also get_include Returns the directory containing NumPy C header f...
numpy.reference.generated.numpy.show_config
numpy.sign numpy.sign(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = <ufunc 'sign'> Returns an element-wise indication of the sign of a number. The sign function returns -1 if x < 0, 0 if x==0, 1 if x > 0. nan is returned for nan inputs. For complex inp...
numpy.reference.generated.numpy.sign
numpy.signbit numpy.signbit(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = <ufunc 'signbit'> Returns element-wise True where signbit is set (less than zero). Parameters xarray_like The input value(s). outndarray, None, or tuple of ndarray and No...
numpy.reference.generated.numpy.signbit
numpy.sin numpy.sin(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = <ufunc 'sin'> Trigonometric sine, element-wise. Parameters xarray_like Angle, in radians (\(2 \pi\) rad equals 360 degrees). outndarray, None, or tuple of ndarray and None, optio...
numpy.reference.generated.numpy.sin
numpy.sinc numpy.sinc(x)[source] Return the normalized sinc function. The sinc function is \(\sin(\pi x)/(\pi x)\). Note Note the normalization factor of pi used in the definition. This is the most commonly used definition in signal processing. Use sinc(x / np.pi) to obtain the unnormalized sinc function \(\sin(x)...
numpy.reference.generated.numpy.sinc
class numpy.single[source] Single-precision floating-point number type, compatible with C float. Character code 'f' Alias on this platform (Linux x86_64) numpy.float32: 32-bit-precision floating-point number type: sign bit, 8 bits exponent, 23 bits mantissa.
numpy.reference.arrays.scalars#numpy.single
numpy.singlecomplex[source] alias of numpy.csingle
numpy.reference.arrays.scalars#numpy.singlecomplex
numpy.sinh numpy.sinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = <ufunc 'sinh'> Hyperbolic sine, element-wise. Equivalent to 1/2 * (np.exp(x) - np.exp(-x)) or -1j * np.sin(1j*x). Parameters xarray_like Input array. outndarray, None, or tuple...
numpy.reference.generated.numpy.sinh
numpy.sort numpy.sort(a, axis=- 1, kind=None, order=None)[source] Return a sorted copy of an array. Parameters aarray_like Array to be sorted. axisint or None, optional Axis along which to sort. If None, the array is flattened before sorting. The default is -1, which sorts along the last axis. kind{‘qui...
numpy.reference.generated.numpy.sort
numpy.sort_complex numpy.sort_complex(a)[source] Sort a complex array using the real part first, then the imaginary part. Parameters aarray_like Input array Returns outcomplex ndarray Always returns a sorted complex array. Examples >>> np.sort_complex([5, 3, 6, 2, 1]) array([1.+0.j, 2.+0.j, 3.+0.j...
numpy.reference.generated.numpy.sort_complex
numpy.source numpy.source(object, output=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>)[source] Print or write to a file the source code for a NumPy object. The source code is only returned for objects written in Python. Many functions and classes are defined in C and will therefore not return usefu...
numpy.reference.generated.numpy.source
numpy.spacing numpy.spacing(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = <ufunc 'spacing'> Return the distance between x and the nearest adjacent number. Parameters xarray_like Values to find the spacing of. outndarray, None, or tuple of ndarr...
numpy.reference.generated.numpy.spacing
numpy.split numpy.split(ary, indices_or_sections, axis=0)[source] Split an array into multiple sub-arrays as views into ary. Parameters aryndarray Array to be divided into sub-arrays. indices_or_sectionsint or 1-D array If indices_or_sections is an integer, N, the array will be divided into N equal arrays...
numpy.reference.generated.numpy.split
numpy.sqrt numpy.sqrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = <ufunc 'sqrt'> Return the non-negative square-root of an array, element-wise. Parameters xarray_like The values whose square-roots are required. outndarray, None, or tuple of n...
numpy.reference.generated.numpy.sqrt
numpy.square numpy.square(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = <ufunc 'square'> Return the element-wise square of the input. Parameters xarray_like Input data. outndarray, None, or tuple of ndarray and None, optional A location into ...
numpy.reference.generated.numpy.square
numpy.squeeze numpy.squeeze(a, axis=None)[source] Remove axes of length one from a. Parameters aarray_like Input data. axisNone or int or tuple of ints, optional New in version 1.7.0. Selects a subset of the entries of length one in the shape. If an axis is selected with shape entry greater than one, an...
numpy.reference.generated.numpy.squeeze
numpy.stack numpy.stack(arrays, axis=0, out=None)[source] 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. New in version 1.10.0. ...
numpy.reference.generated.numpy.stack
numpy.std numpy.std(a, axis=None, dtype=None, out=None, ddof=0, keepdims=<no value>, *, where=<no value>)[source] 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 flat...
numpy.reference.generated.numpy.std
class numpy.str_[source] A unicode string. When used in arrays, this type strips trailing null codepoints. Unlike the builtin str, this supports the Buffer Protocol, exposing its contents as UCS4: >>> m = memoryview(np.str_("abc")) >>> m.format '3w' >>> m.tobytes() b'a\x00\x00\x00b\x00\x00\x00c\x00\x00\x00' Charact...
numpy.reference.arrays.scalars#numpy.str_
numpy.string_[source] alias of numpy.bytes_
numpy.reference.arrays.scalars#numpy.string_
numpy.subtract numpy.subtract(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = <ufunc 'subtract'> Subtract arguments, element-wise. Parameters x1, x2array_like The arrays to be subtracted from each other. If x1.shape != x2.shape, they must be b...
numpy.reference.generated.numpy.subtract
numpy.sum numpy.sum(a, axis=None, dtype=None, out=None, keepdims=<no value>, initial=<no value>, where=<no value>)[source] Sum of array elements over a given axis. Parameters aarray_like Elements to sum. axisNone or int or tuple of ints, optional Axis or axes along which a sum is performed. The default, a...
numpy.reference.generated.numpy.sum
numpy.swapaxes numpy.swapaxes(a, axis1, axis2)[source] Interchange two axes of an array. Parameters aarray_like Input array. axis1int First axis. axis2int Second axis. Returns a_swappedndarray For NumPy >= 1.10.0, if a is an ndarray, then a view of a is returned; otherwise a new array is creat...
numpy.reference.generated.numpy.swapaxes
numpy.take numpy.take(a, indices, axis=None, out=None, mode='raise')[source] Take elements from an array along an axis. When axis is not None, 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. A call such a...
numpy.reference.generated.numpy.take
numpy.take_along_axis numpy.take_along_axis(arr, indices, axis)[source] Take values from the input array by matching 1d index and data slices. This iterates over matching 1d slices oriented along the specified axis in the index and data arrays, and uses the former to look up values in the latter. These slices can b...
numpy.reference.generated.numpy.take_along_axis
numpy.tan numpy.tan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = <ufunc 'tan'> Compute tangent element-wise. Equivalent to np.sin(x)/np.cos(x) element-wise. Parameters xarray_like Input array. outndarray, None, or tuple of ndarray and None, op...
numpy.reference.generated.numpy.tan
numpy.tanh numpy.tanh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = <ufunc 'tanh'> Compute hyperbolic tangent element-wise. Equivalent to np.sinh(x)/np.cosh(x) or -1j * np.tan(1j*x). Parameters xarray_like Input array. outndarray, None, or tupl...
numpy.reference.generated.numpy.tanh
numpy.tensordot numpy.tensordot(a, b, axes=2)[source] Compute tensor dot product along specified axes. Given two tensors, a and b, and an array_like object containing two array_like objects, (a_axes, b_axes), sum the products of a’s and b’s elements (components) over the axes specified by a_axes and b_axes. The thi...
numpy.reference.generated.numpy.tensordot
Testing Guidelines Introduction Until the 1.15 release, NumPy used the nose testing framework, it now uses the pytest framework. The older framework is still maintained in order to support downstream projects that use the old numpy framework, but all tests for NumPy should use pytest. Our goal is that every module and...
numpy.reference.testing
numpy.testing.suppress_warnings class numpy.testing.suppress_warnings(forwarding_rule='always')[source] Context manager and decorator doing much the same as warnings.catch_warnings. However, it also provides a filter mechanism to work around https://bugs.python.org/issue4180. This bug causes Python before 3.4 to no...
numpy.reference.generated.numpy.testing.suppress_warnings
numpy.testing.Tester numpy.testing.Tester[source] alias of numpy.testing._private.nosetester.NoseTester
numpy.reference.generated.numpy.testing.tester
numpy.tile numpy.tile(A, reps)[source] Construct an array by repeating A the number of times given by reps. If reps has length d, the result will have dimension of max(d, A.ndim). If A.ndim < d, A is promoted to be d-dimensional by prepending new axes. So a shape (3,) array is promoted to (1, 3) for 2-D replication...
numpy.reference.generated.numpy.tile
class numpy.timedelta64[source] A timedelta stored as a 64-bit integer. See Datetimes and Timedeltas for more information. Character code 'm'
numpy.reference.arrays.scalars#numpy.timedelta64
numpy.trace numpy.trace(a, offset=0, axis1=0, axis2=1, dtype=None, out=None)[source] Return the sum along diagonals of the array. If a is 2-D, the sum along its diagonal with the given offset is returned, i.e., the sum of elements a[i,i+offset] for all i. If a has more than two dimensions, then the axes specified b...
numpy.reference.generated.numpy.trace
numpy.transpose numpy.transpose(a, axes=None)[source] Reverse or permute the axes of an array; returns the modified array. For an array a with two axes, transpose(a) gives the matrix transpose. Refer to numpy.ndarray.transpose for full documentation. Parameters aarray_like Input array. axestuple or list of ...
numpy.reference.generated.numpy.transpose
numpy.trapz numpy.trapz(y, x=None, dx=1.0, axis=- 1)[source] Integrate along the given axis using the composite trapezoidal rule. If x is provided, the integration happens in sequence along its elements - they are not sorted. Integrate y (x) along each 1d slice on the given axis, compute \(\int y(x) dx\). When x is...
numpy.reference.generated.numpy.trapz
numpy.tri numpy.tri(N, M=None, k=0, dtype=<class 'float'>, *, like=None)[source] An array with ones at and below the given diagonal and zeros elsewhere. Parameters Nint Number of rows in the array. Mint, optional Number of columns in the array. By default, M is taken equal to N. kint, optional The sub...
numpy.reference.generated.numpy.tri
numpy.tril numpy.tril(m, k=0)[source] Lower triangle of an array. Return a copy of an array with elements above the k-th diagonal zeroed. For arrays with ndim exceeding 2, tril will apply to the final two axes. Parameters marray_like, shape (…, M, N) Input array. kint, optional Diagonal above which to zer...
numpy.reference.generated.numpy.tril
numpy.tril_indices numpy.tril_indices(n, k=0, m=None)[source] Return the indices for the lower-triangle of an (n, m) array. Parameters nint The row dimension of the arrays for which the returned indices will be valid. kint, optional Diagonal offset (see tril for details). mint, optional New in versio...
numpy.reference.generated.numpy.tril_indices
numpy.tril_indices_from numpy.tril_indices_from(arr, k=0)[source] Return the indices for the lower-triangle of arr. See tril_indices for full details. Parameters arrarray_like The indices will be valid for square arrays whose dimensions are the same as arr. kint, optional Diagonal offset (see tril for det...
numpy.reference.generated.numpy.tril_indices_from
numpy.trim_zeros numpy.trim_zeros(filt, trim='fb')[source] Trim the leading and/or trailing zeros from a 1-D array or sequence. Parameters filt1-D array or sequence Input array. trimstr, optional A string with ‘f’ representing trim from front and ‘b’ to trim from back. Default is ‘fb’, trim zeros from bot...
numpy.reference.generated.numpy.trim_zeros
numpy.triu numpy.triu(m, k=0)[source] Upper triangle of an array. Return a copy of an array with the elements below the k-th diagonal zeroed. For arrays with ndim exceeding 2, triu will apply to the final two axes. Please refer to the documentation for tril for further details. See also tril lower triangle of an...
numpy.reference.generated.numpy.triu
numpy.triu_indices numpy.triu_indices(n, k=0, m=None)[source] Return the indices for the upper-triangle of an (n, m) array. Parameters nint The size of the arrays for which the returned indices will be valid. kint, optional Diagonal offset (see triu for details). mint, optional New in version 1.9.0. ...
numpy.reference.generated.numpy.triu_indices
numpy.triu_indices_from numpy.triu_indices_from(arr, k=0)[source] Return the indices for the upper-triangle of arr. See triu_indices for full details. Parameters arrndarray, shape(N, N) The indices will be valid for square arrays. kint, optional Diagonal offset (see triu for details). Returns triu_i...
numpy.reference.generated.numpy.triu_indices_from
numpy.true_divide numpy.true_divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = <ufunc 'true_divide'> Returns a true division of the inputs, element-wise. Unlike ‘floor division’, true division adjusts the output type to present the best answer,...
numpy.reference.generated.numpy.true_divide
numpy.trunc numpy.trunc(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = <ufunc 'trunc'> Return the truncated value of the input, element-wise. The truncated value of the scalar x is the nearest integer i which is closer to zero than x is. In short, the f...
numpy.reference.generated.numpy.trunc