Search
Search Results
Search finished, found 89 page(s) matching the search query.
- numpy.dtype.kind
...NumPy reference Array objects Data type objects (dtype) numpy.dtype.kind...
- numpy.dtype.kind (Python attribute, in numpy.dtype.kind)
- Data type objects (
dtype
)...l be accessed and used directly. The attribute must return something that is convertible into a dtype object. Several kinds of strings can be converted. Recognized strings can be prepended with '>' (big-endian), '<' (little-endian), or '=...
- Data type promotion in NumPy
...levant. Note that these detailed rules do not always match those of other languages [1]. Numerical dtypes come in four “kinds” with a natural hierarchy. unsigned integers (uint) signed integers (int) float (float) complex (complex) In add...
- How to extend NumPy
...be done to finish the extension module is to actually write the code that performs the desired functions. There are two kinds of functions: those that don’t accept keyword arguments, and those that do. Functions without keyword arguments F...
- Interoperability with NumPy
...[[1, 2],[3, 4]] >>> x_np = np.array(data) >>> x_tensor = torch.tensor(data) Note that x_np and x_tensor are different kinds of objects: >>> x_np array([[1, 2], [3, 4]]) >>> x_tensor tensor([[1, 2], [3, 4]]) However, we ca...
- Miscellaneous
...divide, and overflow and 'ignore' for underflow. But this can be changed, and it can be set individually for different kinds of exceptions. The different behaviors are: ‘ignore’ : Take no action when the exception occurs. ‘warn’ : Prin...
- NumPy 1.11.0 Release Notes
...ct data-type The function now internally calls the generic npy_amergesort when the type does not implement a merge-sort kind of argsort method. np.ma.core.MaskedArray now supports an order argument When constructing a new MaskedArray inst...
- NumPy 1.12.0 Release Notes
...sum summation notation. See np.einsum_path for more details. quicksort has been changed to an introsort The quicksort kind of np.sort and np.argsort is now an introsort which is regular quicksort but changing to a heapsort when not enough...
- NumPy 1.14.0 Release Notes
...olynomial.chebyshev The new chebinterpolate function interpolates a given function at the Chebyshev points of the first kind. A new Chebyshev.interpolate class method adds support for interpolation over arbitrary intervals using the scaled...
- NumPy 1.15.0 Release Notes
...operators to return expressions, to be compared elementwise with np.equal(a, b, dtype=object). sort functions accept kind='stable' Up until now, to perform a stable sort on the data, the user must do: >>> np.sort([5, 2, 6, 2, 1], kind='m...
- NumPy 1.15.1 Release Notes
...ression in loadtxt for bz2 text files in Python 2. #11757: BUG: Revert use of console_scripts. #11758: BUG: Fix Fortran kind detection for aarch64 & s390x. #11759: BUG: Fix printing of longdouble on ppc64le. #11760: BUG: Fixes for unicode f...
- NumPy 1.17.0 Release Notes
...een implemented and are now used in place of mergesort. Due to the need to maintain backward compatibility, the sorting kind options "stable" and "mergesort" have been made aliases of each other with the actual sort implementation depending...
- NumPy 1.20.0 Release Notes
...wishes to compile against an older version of NumPy, it must replace the macro (see also C API changes section). Same kind casting in concatenate with axis=None When concatenate is called with axis=None, the flattened arrays were cast wit...
- NumPy 1.24 Release Notes
...dtype keyword arguments are now available for numpy.stack. To use them, write np.stack(..., dtype=None, casting='same_kind'). casting and dtype keyword arguments for numpy.vstack The casting and dtype keyword arguments are now available...
- NumPy 1.25.0 Release Notes
...stacking family of functions (stack, vstack, hstack, dstack and column_stack). (gh-23019) np.clip now defaults to same-kind casting. Falling back to unsafe casting was deprecated in NumPy 1.17. (gh-23403) np.clip will now propagate np.nan...
- NumPy 1.26.0 Release Notes
...p mypy to 1.4.1 #24542: BUG: Fix assumed length f2py regression #24544: MAINT: Harmonize fortranobject #24545: TYP: add kind argument to numpy.isin type specification #24561: BUG: fix comparisons between masked and unmasked structured array...
- NumPy 2.0 migration guide
...type Use a specific dtype instead. You should avoid relying on any implicit mechanism and select the largest dtype of a kind explicitly in the code. NaN Use np.nan instead. nbytes Use np.dtype(<dtype>).itemsize instead. NINF Use -np.inf...
- NumPy 2.0.0 Release Notes
...trinsic module. These type maps are now natively supported by f2py (gh-24555) f2py now handles common blocks which have kind specifications from modules. This further expands the usability of intrinsics like iso_fortran_env and iso_c_bindin...
- NumPy 2.1.0 Release Notes
...ost. This means the following examples change slightly: np.copyto(int8_arr, 1000) previously performed an unsafe/same-kind castof the Python integer. It will now always raise, to achieve an unsafe cast you must pass an array or NumPy sca...
- NumPy 2.3.0 Release Notes
...g.mypy_plugin from the plugins section of your mypy configuration. If this change results in new errors being reported, kindly open an issue. (gh-28129) The numpy.typing.NBitBase type has been deprecated and will be removed in a future ver...
- NumPy C code explanations
...s no subarray but needs some care during setup. Deciding what case applies, checking broadcasting, and determining the kind of transposition needed are all done in PyArray_MapIterNew. After setting up, there are two cases. If there is no s...
- numpy.__array_namespace_info__.dtypes
...numpy.__array_namespace_info__.dtypes method __array_namespace_info__.dtypes(*, device=None, kind=None)[source] The array API data types supported by NumPy. Note that this function only returns data types that are...
- numpy.argpartition
...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...
- numpy.argsort
...numpy.argsort numpy.argsort(a, axis=-1, kind=None, order=None, *, stable=None)[source] Returns the indices that would sort an array. Perform an indirect sort al...
- numpy.can_cast
...y scalar, or array to cast from. todtype or dtype specifierData type to cast to. casting{‘no’, ‘equiv’, ‘safe’, ‘same_kind’, ‘unsafe’}, optionalControls what kind of data casting may occur. ‘no’ means the data types should not be cast at...
- numpy.char.chararray.astype
...ose to the order the array elements appear in memory as possible. Default is ‘K’. casting{‘no’, ‘equiv’, ‘safe’, ‘same_kind’, ‘unsafe’}, optionalControls what kind of data casting may occur. Defaults to ‘unsafe’ for backwards compatibility...
- numpy.char.chararray.sort
...numpy.char.chararray.sort method char.chararray.sort(axis=-1, kind=None, order=None) Sort an array in-place. Refer to numpy.sort for full documentation. Parameters: axisint, option...
- numpy.concat
...numpy.concat numpy.concat((a1, a2, ...), axis=0, out=None, dtype=None, casting="same_kind") Join a sequence of arrays along an existing axis. Parameters: a1, a2, …sequence of array_likeThe arrays must ha...
- numpy.concatenate
...numpy.concatenate numpy.concatenate((a1, a2, ...), axis=0, out=None, dtype=None, casting="same_kind") Join a sequence of arrays along an existing axis. Parameters: a1, a2, …sequence of array_likeThe arrays must ha...
- numpy.dot
...aarray_likeFirst argument. barray_likeSecond argument. outndarray, optionalOutput argument. This must have the exact kind that would be returned if it was not used. In particular, it must have the right type, must be C-contiguous, and it...
- numpy.dtype
...ng whether the byte order of this dtype is native to the platform. itemsizeThe element size of this data-type object. kindA character code (one of ‘biufcmMOSTUV’) identifying the general kind of data. metadataEither None or a readonly di...
- numpy.dtype.kind
...NumPy reference Array objects Data type objects (dtype) numpy.dtype.kind...
- numpy.einsum
...s the inputs as is possible, including arbitrarily permuted axes. Default is ‘K’. casting{‘no’, ‘equiv’, ‘safe’, ‘same_kind’, ‘unsafe’}, optionalControls what kind of data casting may occur. Setting this to ‘unsafe’ is not recommended, as...
- numpy.finfo
...class numpy.finfo(dtype)[source] Machine limits for floating point types. Parameters: dtypefloat, dtype, or instanceKind of floating point or complex floating point data-type about which to get information. See also iinfoThe equiv...
- numpy.hstack
...numpy.hstack numpy.hstack(tup, *, dtype=None, casting='same_kind')[source] Stack arrays in sequence horizontally (column wise). This is equivalent to concatenation along the second...
- numpy.i0
...numpy.i0 numpy.i0(x)[source] Modified Bessel function of the first kind, order 0. Usually denoted \(I_0\). Parameters: xarray_like of floatArgument of the Bessel function. Returns:...
- numpy.iinfo
...s numpy.iinfo(type)[source] Machine limits for integer types. Parameters: int_typeinteger type, dtype, or instanceThe kind of integer data type to get information about. See also finfoThe equivalent for floating point data types....
- numpy.in1d
...numpy.in1d numpy.in1d(ar1, ar2, assume_unique=False, invert=False, *, kind=None)[source] Test whether each element of a 1-D array is also present in a second array. Deprecated since version...
- numpy.isdtype
...numpy.isdtype numpy.isdtype(dtype, kind)[source] Determine if a provided dtype is of a specified data type kind. This function only supports built-in NumPy...
- numpy.isin
...numpy.isin numpy.isin(element, test_elements, assume_unique=False, invert=False, *, kind=None)[source] Calculates element in test_elements, broadcasting over element only. Returns a boolean array of the s...
- numpy.lexsort
...1), (4, 2), (4, 4), (5, 4)] Compare against argsort, which would sort each key independently. >>> np.argsort((b, a), kind='stable') array([[2, 4, 6, 5, 1, 3, 0], [0, 2, 4, 3, 5, 6, 1]]) To sort lexicographically with argsort, we...
- numpy.linalg.multi_dot
...eated as column vector. The other arguments must be 2-D. outndarray, optionalOutput argument. This must have the exact kind that would be returned if it was not used. In particular, it must have the right type, must be C-contiguous, and it...
- numpy.ma.dot
...lumn, the whole row or column is considered masked. outmasked_array, optionalOutput argument. This must have the exact kind that would be returned if it was not used. In particular, it must have the right type, must be C-contiguous, and it...
- numpy.ma.hstack
...ill have this dtype. Cannot be provided together with out. New in version 1.24. casting{‘no’, ‘equiv’, ‘safe’, ‘same_kind’, ‘unsafe’}, optionalControls what kind of data casting may occur. Defaults to ‘same_kind’. New in version 1.24....
- numpy.ma.masked_array.astype
...ose to the order the array elements appear in memory as possible. Default is ‘K’. casting{‘no’, ‘equiv’, ‘safe’, ‘same_kind’, ‘unsafe’}, optionalControls what kind of data casting may occur. Defaults to ‘unsafe’ for backwards compatibility...
- numpy.ma.masked_array.dot
...tory. Parameters: bmasked_array_likeInputs array. outmasked_array, optionalOutput argument. This must have the exact kind that would be returned if it was not used. In particular, it must have the right type, must be C-contiguous, and it...
- numpy.ma.masked_array.partition
...numpy.ma.masked_array.partition method ma.masked_array.partition(kth, axis=-1, kind='introselect', order=None)[source] Partially sorts the elements in the array in such a way that the value of the el...
- numpy.ma.MaskedArray.astype
...ose to the order the array elements appear in memory as possible. Default is ‘K’. casting{‘no’, ‘equiv’, ‘safe’, ‘same_kind’, ‘unsafe’}, optionalControls what kind of data casting may occur. Defaults to ‘unsafe’ for backwards compatibility...
- numpy.ma.stack
...ill have this dtype. Cannot be provided together with out. New in version 1.24. casting{‘no’, ‘equiv’, ‘safe’, ‘same_kind’, ‘unsafe’}, optionalControls what kind of data casting may occur. Defaults to ‘same_kind’. New in version 1.24....
- numpy.ma.vstack
...ill have this dtype. Cannot be provided together with out. New in version 1.24. casting{‘no’, ‘equiv’, ‘safe’, ‘same_kind’, ‘unsafe’}, optionalControls what kind of data casting may occur. Defaults to ‘same_kind’. New in version 1.24....
- numpy.matrix.astype
...ose to the order the array elements appear in memory as possible. Default is ‘K’. casting{‘no’, ‘equiv’, ‘safe’, ‘same_kind’, ‘unsafe’}, optionalControls what kind of data casting may occur. Defaults to ‘unsafe’ for backwards compatibility...
- numpy.matrix.partition
...numpy.matrix.partition method matrix.partition(kth, axis=-1, kind='introselect', order=None) Partially sorts the elements in the array in such a way that the value of the element in...
- numpy.matrix.sort
...numpy.matrix.sort method matrix.sort(axis=-1, kind=None, order=None) Sort an array in-place. Refer to numpy.sort for full documentation. Parameters: axisint, option...
- numpy.memmap.astype
...ose to the order the array elements appear in memory as possible. Default is ‘K’. casting{‘no’, ‘equiv’, ‘safe’, ‘same_kind’, ‘unsafe’}, optionalControls what kind of data casting may occur. Defaults to ‘unsafe’ for backwards compatibility...
- numpy.memmap.partition
...numpy.memmap.partition method memmap.partition(kth, axis=-1, kind='introselect', order=None) Partially sorts the elements in the array in such a way that the value of the element in...
- numpy.memmap.sort
...numpy.memmap.sort method memmap.sort(axis=-1, kind=None, order=None) Sort an array in-place. Refer to numpy.sort for full documentation. Parameters: axisint, option...
- numpy.min_scalar_type
...calar_type numpy.min_scalar_type(a, /) For scalar a, returns the data type with the smallest size and smallest scalar kind which can hold its value. For non-scalar array a, returns the vector’s dtype unmodified. Floating point values are...
- numpy.ndarray.astype
...ose to the order the array elements appear in memory as possible. Default is ‘K’. casting{‘no’, ‘equiv’, ‘safe’, ‘same_kind’, ‘unsafe’}, optionalControls what kind of data casting may occur. Defaults to ‘unsafe’ for backwards compatibility...
- numpy.ndarray.partition
...numpy.ndarray.partition method ndarray.partition(kth, axis=-1, kind='introselect', order=None) Partially sorts the elements in the array in such a way that the value of the element in...
- numpy.ndarray.sort
...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, option...
- numpy.nditer
...nds, as they are allocated to be compatible with iteration order. Default is ‘K’. casting{‘no’, ‘equiv’, ‘safe’, ‘same_kind’, ‘unsafe’}, optionalControls what kind of data casting may occur when making a copy or buffering. Setting this to...
- numpy.partition
...numpy.partition numpy.partition(a, kth, axis=-1, kind='introselect', order=None)[source] Return a partitioned copy of an array. Creates a copy of the array and partially...
- numpy.promote_types
...umpy.promote_types numpy.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 considered “canonical”, this mai...
- numpy.recarray.astype
...ose to the order the array elements appear in memory as possible. Default is ‘K’. casting{‘no’, ‘equiv’, ‘safe’, ‘same_kind’, ‘unsafe’}, optionalControls what kind of data casting may occur. Defaults to ‘unsafe’ for backwards compatibility...
- numpy.recarray.partition
...numpy.recarray.partition method recarray.partition(kth, axis=-1, kind='introselect', order=None) Partially sorts the elements in the array in such a way that the value of the element in...
- numpy.recarray.sort
...numpy.recarray.sort method recarray.sort(axis=-1, kind=None, order=None) Sort an array in-place. Refer to numpy.sort for full documentation. Parameters: axisint, option...
- numpy.result_type
...es are determined by first checking which of boolean, integer (int/uint), or floating point (float/complex) the maximum kind of all the arrays and the scalars are. If there are only scalars or the maximum category of the scalars is higher t...
- numpy.sort
...numpy.sort numpy.sort(a, axis=-1, kind=None, order=None, *, stable=None)[source] Return a sorted copy of an array. Parameters: aarray_likeArray to be so...
- numpy.stack
...numpy.stack numpy.stack(arrays, axis=0, out=None, *, dtype=None, casting='same_kind')[source] Join a sequence of arrays along a new axis. The axis parameter specifies the index of the new axis in the...
- numpy.vstack
...numpy.vstack numpy.vstack(tup, *, dtype=None, casting='same_kind')[source] Stack arrays in sequence vertically (row wise). This is equivalent to concatenation along the first axis...
- NumPy: the absolute basics for beginners
...s This section covers np.sort(), np.concatenate() Sorting an array is simple with np.sort(). You can specify the axis, kind, and order when you call the function. If you start with this array: >>> arr = np.array([2, 1, 5, 3, 7, 4, 6, 8])...
- Python types and C-structures
...(PyArray_Descr) It has the following structure: typedef struct { PyObject_HEAD PyTypeObject *typeobj; char kind; char type; char byteorder; char _former_flags; // unused field int type_num; /* * Defini...
- Advanced debugging tools
...necessary if you do not run the full test suite). If you wish to detect memory leaks you will also require --show-leak-kinds=definite and possibly more valgrind options. Just as for pytest-leaks certain tests are known to leak cause error...
- Array API
...yArray_Descr *PyArray_PromoteTypes(PyArray_Descr *type1, PyArray_Descr *type2) Finds the data type of smallest size and kind to which type1 and type2 may be safely converted. This function is symmetric and associative. A string or unicode r...
- Boilerplate reduction and templating
...nd subroutine ${dtype_prefix}$add #:enddef #:for dtype_prefix, dtype in [('i', 'integer'), ('s', 'real'), ('d', 'real(kind=8)'), ('c', 'complex'), ('z', 'double complex')] @:add_subroutine(${dtype_prefix}$, ${dtype}$) #:endfor end mo...
- Data type API
..., 32, 64, 80, 96, 128, 160, 192, 256, and 512. Obviously not all bit-widths are available on all platforms for all the kinds of numeric types. Commonly 8-, 16-, 32-, 64-bit integers; 32-, 64-bit floats; and 64-, 128-bit complex types are a...
- Datetimes and timedeltas
...ine 1, in <module> TypeError: Cannot cast NumPy timedelta64 scalar from metadata [Y] to [D] according to the rule 'same_kind' Go BackOpen In Tabdocument.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../t...
- Glossary
...asts that can preserve values are allowed. Upcasting (e.g., from int to float) is allowed, but downcasting is not. same_kind: The ‘same_kind’ casting option allows safe casts and casts within a kind, like float64 to float32. unsafe: any dat...
- Importing data with
genfromtxt
...omplex strings, such as "N/A" or "???" to represent missing or invalid data. The missing_values argument accepts three kinds of values: a string or a comma-separated stringThis string will be used as the marker for missing data for all th...
- Indexing on
ndarrays
...can be indexed using the standard Python x[obj] syntax, where x is the array and obj the selection. There are different kinds of indexing available depending on obj: basic indexing, advanced indexing and field access. Most of the following...
- Reviewer guidelines
...e by line, or to open with small pervasive issues. You are the face of the project, and NumPy some time ago decided the kind of project it will be: open, empathetic, welcoming, friendly and patient. Be kind to contributors. Do not let perfe...
- Scalars
...rarchy: For example, isinstance(val, np.generic) will return True if val is an array scalar object. Alternatively, what kind of array scalar is present can be determined using other members of the data type hierarchy. Thus, for example isin...
- Signature file
...pespec> [ [<attrspec>] :: ] <entitydecl> where <typespec> := byte | character [<charselector>] | complex [<kindselector>] | real [<kindselector>] | double complex | double precision | integer [<kindselecto...
- Structured arrays
...5.0: A view can now be returned if the fields are separated by a uniform stride. casting{‘no’, ‘equiv’, ‘safe’, ‘same_kind’, ‘unsafe’}, optionalSee casting argument of numpy.ndarray.astype. Controls what kind of data casting may occur....
- The N-dimensional array (
ndarray
)...er (used, for example, in the Fortran language and in Matlab) and row-major order (used in C) schemes are just specific kinds of strided scheme, and correspond to memory that can be addressed by the strides: \[s_k^{\mathrm{column}} = \math...
- Universal functions (
ufunc
)...ation of the dimensions in the output can be controlled with axes and axis. casting May be ‘no’, ‘equiv’, ‘safe’, ‘same_kind’, or ‘unsafe’. See can_cast for explanations of the parameter values. Provides a policy for what kind of casting is...
- Universal functions (
ufunc
) basics...t-in functions are implemented in compiled C code. The basic ufuncs operate on scalars, but there is also a generalized kind for which the basic elements are sub-arrays (vectors, matrices, etc.), and broadcasting is done over other dimensio...
- Using Python as glue
...ing some arguments output arguments). In this process, the requires function in NumPy may be useful to return the right kind of array from a given input. Complete example In this example, we will demonstrate how the addition function and...