About 225,000 results
Open links in new tab
  1. arrays - what does numpy ndarray shape do? - Stack Overflow

    Nov 30, 2017 · yourarray.shape or np.shape() or np.ma.shape() returns the shape of your ndarray as a tuple; And you can get the (number of) dimensions of your array using yourarray.ndim or np.ndim(). …

  2. python - What does .shape [] do in "for i in range (Y.shape [0 ...

    The shape attribute for numpy arrays returns the dimensions of the array. If Y has n rows and m columns, then Y.shape is (n,m). So Y.shape[0] is n.

  3. python - shape vs len for numpy array - Stack Overflow

    May 24, 2016 · Looking at property vs method answers, it all points to usability and readability of code. So again, in your case, I would say if you want information about the whole dataframe just to check …

  4. python - numpy: "size" vs. "shape" in function arguments ... - Stack ...

    Oct 22, 2018 · However, because python users want multi-dimensional arrays, array.reshape allows you to get from 1D to an nD array. So, when you call shape, you get the N dimension shape of the array, …

  5. python - Numpy shape function - Stack Overflow

    Dec 26, 2023 · Shape of A: (2, 2) Shape of b: (2,) I was expecting shape of b to be (1,2) which is one row and two columns, why is it (2,) ?

  6. python - Numpy .shape function - Stack Overflow

    I am teaching myself Python, and encountered an issue I am having difficulty circumventing. I am trying to experiment with the .shape function in the Numpy library and am unable to circumvent this

  7. How to get the the shape and the type of any object in Python

    May 9, 2022 · The solution mentioned here How do I determine the size of an object in Python? just gives the size of any object but not the shape that also includes information about the dimensionality.

  8. python - Explaining the differences between dim, shape, rank, …

    Mar 1, 2014 · I'm new to python and numpy in general. I read several tutorials and still so confused between the differences in dim, ranks, shape, aixes and dimensions. My mind seems to be stuck at …

  9. python - Numpy array dimensions - Stack Overflow

    Jun 22, 2023 · np.shape first turns its argument into an array if it doesn't have the shape attribute, That's why it works on the list and tuple examples.

  10. Difference between numpy.array shape (R, 1) and (R,)

    Shape n, expresses the shape of a 1D array with n items, and n, 1 the shape of a n-row x 1-column array. (R,) and (R,1) just add (useless) parentheses but still express respectively 1D and 2D array …