Skip to content
murmot

Results for “function return python array site:numpy.org”

  • numpy.org

    Array API — NumPy v2.6.dev0 Manual

    This is the main array creation function. Most new arrays are created with this flexible function. The returned object is an object of Python-type subtype, which must be a subtype of PyArray_Type. The array has nd dimensions, described by dims.

  • numpy.org

    numpy.array — NumPy v2.5 Manual

    numpy.array # numpy.array(object, dtype=None, *, copy=True, order='K', subok=False, ndmin=0, ndmax=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-dimensional array containing object is returned. dtypedata-type, optional The ...

  • numpy.org

    numpy.arange — NumPy v2.1 Manual

    For integer arguments the function is roughly equivalent to the Python built-in range , but returns an ndarray rather than a range instance. When using a ...

  • numpy.org

    NumPy quickstart — NumPy v2.6.dev0 Manual

    For example, you can create an array from a regular Python list or tuple using the array function. The type of the resulting array is deduced from the type of the elements in the sequences.

  • numpy.org

    numpy.where — NumPy v2.5 Manual

    Parameters: conditionarray_like, bool Where True, yield x, otherwise yield y. x, yarray_like Values from which to choose. x, y and condition need to be broadcastable to some shape. Returns: outndarray An array with elements from x where condition is True, and elements from y elsewhere.

  • numpy.org

    Array creation routines — NumPy v2.5 Manual

    Return an array copy of the given object. frombuffer(buffer[, dtype, count, offset, like]). Interpret a buffer as a 1-dimensional array.fromfunction(function, shape, *[, dtype, like]). Construct an array by executing a function over each coordinate.

  • numpy.org

    Writing custom array containers — NumPy v2.5 Manual

    Lists of every overridable function in the Numpy API are also available via get_overridable_numpy_array_functions for functions that support the __array_function__ protocol and get_overridable_numpy_ufuncs for functions that support the __array_ufunc__ protocol. Both functions return sets of functions that are present in the Numpy public API.

  • numpy.org

    NumPy: the absolute basics for beginners

    As with built-in Python sequences, NumPy arrays are “0 ... By default, every NumPy aggregation function will return the aggregate of the entire array.

  • numpy.org

    Array creation — NumPy v2.5 Manual

    Introduction # There are 6 general mechanisms for creating arrays: Conversion from other Python structures (i.e. lists and tuples) Intrinsic NumPy array creation functions (e.g. arange, ones, zeros, etc.) Replicating, joining, or mutating existing arrays Reading arrays from disk, either from standard or custom formats Creating arrays from raw bytes through the use of strings or buffers Use of ...

  • numpy.org

    numpy.where — NumPy v2.7.dev0 Manual

    Return elements chosen from x or y depending on condition. ... When only condition is provided, this function is a shorthand for np.asarray(condition).nonzero() .

  • numpy.org

    NumPy quickstart — NumPy v2.5 Manual

    For example, you can create an array from a regular Python list or tuple using the array function. The type of the resulting array is deduced from the type of the elements in the sequences.

  • numpy.org

    numpy.asarray — NumPy v2.5 Manual

    likearray_like, optional Reference object to allow the creation of arrays which are not NumPy arrays. If an array-like passed in as like supports the __array_function__ protocol, the result will be defined by it. In this case, it ensures the creation of an array object compatible with that passed in via this argument.

  • numpy.org

    Array API — NumPy v2.5 Manual

    Return an ndarray object from a Python object that exposes the __array__ method. The third-party implementations of __array__ must take dtype and copy keyword ...