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

    Apr 8, 2013 · 365 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. From the …

  2. What does [:, :] mean on NumPy arrays - Stack Overflow

    self.activity = numpy.zeros((512,512)) self.activity[:,:] = self.h Perhaps the fastest way to do this is to allocate an empty array and .fill it with the expected value:

  3. python - initialize a numpy array - Stack Overflow

    Is there way to initialize a numpy array of a shape and add to it? I will explain what I need with a list example. If I want to create a list of objects generated in a loop, I can do: a = [] for i...

  4. What are the advantages of NumPy over regular Python lists?

    A NumPy array is an array of uniform values -- single-precision numbers takes 4 bytes each, double-precision ones, 8 bytes. Less flexible, but you pay substantially for the flexibility of standard Python lists!

  5. Most efficient way to forward-fill NaN values in numpy array

    Summary Is there another more efficient way to 'forward-fill' nan values in numpy arrays? (e.g. by using numpy vectorized operations)

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

  7. 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 the new …

  8. How do I add an extra column to a NumPy array? - Stack Overflow

    Add an extra column to a numpy array: Numpy's np.append method takes three parameters, the first two are 2D numpy arrays and the 3rd is an axis parameter instructing along which axis to append:

  9. python - Numpy array dimensions - Stack Overflow

    Jun 22, 2023 · In Numpy, dimension, axis/axes, shape are related and sometimes similar concepts: dimension In Mathematics/Physics, dimension or dimensionality is informally defined as the minimum …

  10. 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 = …