Skip to content
murmot

Results for “python numpy array dtype value function example 1 site:discuss.python.org”

  • discuss.python.org

    Add a `__len__` and `__getitem__` ABC to `collections.a...

    numpy is probably actually the best example here, because np.ndarray is not a Sequence, specifically because they don’t want the “full” Sequence semantics. It’s good to have a “best example” for any proposal. But, the situation with Numpy arrays is extremely complicated.

  • discuss.python.org

    Type-hinting Numpy functions to accept both arrays and ...

    Apr 18, 2023 · This function can accept more or less arbitrary combinations of Numpy arrays of float -based dtypes, “array-like” objects (sequences, objects implementing certain magic methods) containing either Numpy float objects or native Python float s, or individual “scalar” Numpy float objects or native Python float instances.

  • discuss.python.org

    Choice of complex buffer protocol format intentional break with PEP?

    Anyway, Tim’s example of numpy.array([1j], dtype="Zd")not being understood by NumPy can be changed in NumPy if “numpy people” wish it. As Petr pointed out in the SC issue, it’s always possible to accept both values (e.g., both 'Zd’ and 'D’) but only one of them can be chosen when...

  • discuss.python.org

    How to type annotate mathematical operations that supports ...

    Feb 4, 2022 · In scientific code that deals with mathematical operations, before type annotations, it is common to assume that any mathematical function could take in a numpy array. To be explicit you just add to your docstring that you can take array_like or ndarray (as is conventional in NumFocus project docs).

  • discuss.python.org

    Discussions on Python.org

    How to get max value of second column in the specific range? Full len of ndarray is 100+, but I need get max from second column between 25 - 50 indexes (rows, for example, really it’s various indexes each time) … And I don’t know maybe need to change type as first step (for dict/list), maybe it’s possible with this data … plz help. p.s.

  • discuss.python.org

    How to get max/min of "ndarray of dtype [void]" - Python Help ...

    Apr 13, 2022 · I have <class ‘numpy.ndarray’> of many <class ‘numpy.dtype[void]’> … It’s from mql5 integration and they are include int/float data, example of single row: (1649854500, 0.83254, 0.83264, 0.83231, 0.83256, 290, 18, 0) (1649819400, 1.64308, 1.64314, 1.64259, 1.64262, 185, 57, 0) … e.t.c. But I was get many problem with serching max/min values in the axis=1 and many errors with ...

  • discuss.python.org

    numpy array access - Python Discussions

    May 19, 2023 ... Ulrich Häussler-Combe: A = B+C. This makes a new array with the sum values, and uses A as a name for that array. The previous array named A ...

  • discuss.python.org

    Faster Way to Implement Gaussian Smoothing? (Python 3.10...)

    I’m using the NumPy module for my data arrays, and MatPlotLib to plot the data. I wrote a minimal reproducible example, with some randomly-generated data, and each one of the arguments needed for the Gaussian function listed at the top of the main function

  • discuss.python.org

    Discussions on Python.org

    The arguments after the `*` must be passed as keyword arguments, whereas arguments before the `*` can be passed by position, like this: `np.stack (arrays, 1, out_array, dtype=np.int32)` --- _ [View the full topic] (https://discuss.python.org/t/numpy-stack-arrays-axis-0-out-none-dtype-none-casting-same-kind/44455)._