About 4,610,000 results
Open links in new tab
  1. Most efficient way to map function over numpy array

    Feb 5, 2016 · What is the most efficient way to map a function over a numpy array? I am currently doing: import numpy as np x = np.array([1, 2, 3, 4, 5]) # Obtain array of square ...

  2. How do you do natural logs (e.g. "ln()") with numpy in Python?

    Using numpy, how can I do the following: ln(x) Is it equivalent to: np.log(x) I apologise for such a seemingly trivial question, but my understanding of the difference between log and ln is that ...

  3. What does the .numpy() function do? - Stack Overflow

    Sep 19, 2020 · numpy() -> numpy.ndarray Returns :attr:`self` tensor as a NumPy :class:`ndarray`. This tensor and the returned :class:`ndarray` share the same underlying storage. Changes to …

  4. How can I calculate a rolling / moving average using Python

    253 There doesn’t seem to be any function in NumPy or SciPy that simply calculate the moving average, leading to convoluted solutions. My question is twofold: What's the easiest way to …

  5. How do you get the magnitude of a vector in Numpy?

    Feb 7, 2012 · 340 The function you're after is numpy.linalg.norm. (I reckon it should be in base numpy as a property of an array -- say x.norm() -- but oh well).

  6. python numpy/scipy curve fitting - Stack Overflow

    I suggest you to start with simple polynomial fit, scipy.optimize.curve_fit tries to fit a function f that you must know to a set of points. This is a simple 3 degree polynomial fit using numpy.polyfit …

  7. python - Is there a NumPy function to return the first index of ...

    Jan 11, 2009 · One can safely assume that the index() function in Python is implemented so that it stops after finding the first match, and this results in an optimal average performance. For …

  8. How can the Euclidean distance be calculated with NumPy?

    Sep 10, 2009 · Use NumPy (linalg.norm) when you need fast, vectorized distance calculations for large arrays or numerical computations. Use SciPy (distance.euclidean) when you want a …

  9. How to calculate a logistic sigmoid function in Python?

    Oct 21, 2010 · 8 Use the numpy package to allow your sigmoid function to parse vectors. In conformity with Deeplearning, I use the following code:

  10. python - Is there any numpy group by function? - Stack Overflow

    Jun 24, 2016 · 153 Is there any function in numpy to group this array down below by the first column? I couldn't find any good answer over the internet..