About 5,750,000 results
Open links in new tab
  1. What is the difference between ndarray and array in NumPy?

    Jul 30, 2022 · 364 numpy.array is just a convenience function to create an ndarray; it is not a class itself. You can also create an array using numpy.ndarray, but it is not the recommended …

  2. How do I create an empty array and then append to it in NumPy?

    NumPy arrays are stored in contiguous blocks of memory. To append rows or columns to an existing array, the entire array needs to be copied to a new block of memory, creating gaps for …

  3. 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 ...

  4. python - deleting rows in numpy array - Stack Overflow

    2 numpy provides a simple function to do the exact same thing: supposing you have a masked array 'a', calling numpy.ma.compress_rows (a) will delete the rows containing a masked value. …

  5. How to normalize a NumPy array to within a certain range?

    The numpy array I was trying to normalize was an integer array. It seems they deprecated type casting in versions > 1.10, and you have to use numpy.true_divide() to resolve that.

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

    Jan 11, 2009 · I know there is a method for a Python list to return the first index of something: >>> xs = [1, 2, 3] >>> xs.index (2) 1 Is there something like that for NumPy arrays?

  7. python - array.array versus numpy.array - Stack Overflow

    Sep 21, 2008 · Numpy is also much more flexible, e.g. it supports arrays of any type of Python objects, and is also able to interact "natively" with your own objects if they conform to the array …

  8. Multiple conditions using 'or' in numpy array - Stack Overflow

    Multiple conditions using 'or' in numpy array Asked 13 years, 7 months ago Modified 6 years, 4 months ago Viewed 61k times

  9. How do I read CSV data into a record array in NumPy?

    Aug 19, 2010 · data_array = np.asarray(data, dtype = <whatever options>) on 4.6 million rows with about 70 columns and found that the NumPy path took 2 min 16 secs and the csv-list …

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

    Jun 24, 2016 · 28 Numpy is not very handy here because the desired output is not an array of integers (it is an array of list objects). I suggest either the pure Python way...