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

  3. How do I print the full NumPy array, without truncation?

    You can use the printoptions context manager: with numpy.printoptions(threshold=numpy.inf): print(arr) (of course, replace numpy by np if that's how you imported numpy) The use of a context manager …

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

  5. How do I get indices of N maximum values in a NumPy array?

    Aug 2, 2011 · NumPy proposes a way to get the index of the maximum value of an array via np.argmax. I would like a similar thing, but returning the indexes of the N maximum values. For instance, if I have …

  6. python - Pretty-print a NumPy array without scientific notation and ...

    How do I print formatted NumPy arrays in a way similar to this: x = 1.23456 print('%.3f' % x) If I want to print the numpy.ndarray of floats, it prints several decimals, often in 'scientific' form...

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

  8. Convert array of indices to one-hot encoded array in NumPy

    Easy way to "understand" this solution and why it works for N-dims (without reading numpy docs): at each location in the original matrix (values), we have an integer k, and we "put" the 1-hot vector …

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

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

    What does [:, :] mean on NumPy arrays Asked 12 years, 10 months ago Modified 3 years, 3 months ago Viewed 96k times