numpy.array — NumPy v2.5 Manual
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- ...
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- ...
See Assigning values to indexed arrays for specific examples and explanations on how assignments work. Note that in Python, x[(exp1, exp2, ..., expN)] is equivalent to x[exp1, exp2, ..., expN]; the latter is just syntactic sugar for the former.
Return a contiguous flattened array. A 1-D array, containing the elements of ... (for example, a masked array will be returned for a masked array input).
The following example shows how you might write a wrapper that accepts two input arguments (that will be converted to an array) and an output argument (that must be an array). The function returns None and updates the output array.
Array types and conversions between types#. NumPy supports a much greater variety of numerical types than Python does. This section shows which are ...
The __array_function__ protocol. 3. Returning foreign objects. Interoperability examples. Example: Pandas Series objects. Example: PyTorch tensors.Example: CuPy arrays#. CuPy is a NumPy/SciPy-compatible array library for GPU-accelerated computing with Python.
The following example shows how you might write a wrapper that accepts two input arguments (that will be converted to an array) and an output argument (that must be an array). The function returns None and updates the output array.
This example shows a function that filters a two-dimensional array of double precision floating-point numbers using a fixed averaging filter. The advantage of using Fortran to index into multi-dimensional arrays should be clear from this example.