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

    Apr 8, 2013 · 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 way. …

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

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

  4. How do I create a numpy array of all True or all False?

    Jan 16, 2014 · Explanation: numpy creates arrays of all ones or all zeros very easily: e.g. numpy.ones((2, 2)) or numpy.zeros((2, 2)) Since True and False are represented in Python as …

  5. 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 …

  6. How to save a list as numpy array in python? - Stack Overflow

    May 10, 2011 · import numpy as np a = np.array( [2,3,4] ) Or from a from a nested list in the same way:

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

  8. How can I add new dimensions to a Numpy array? - Stack Overflow

    Numpy's speed comes from being able to keep all the data in a numpy array in the same chunk of memory; e.g. mathematical operations can be parallelized for speed and you get less cache …

  9. How do I convert a PIL Image into a NumPy array? - Stack Overflow

    How do I convert a PIL Image back and forth to a NumPy array so that I can do faster pixel-wise transformations than PIL's PixelAccess allows? I can convert it to a NumPy array via: pic = …

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