About 5,370 results
Open links in new tab
  1. numpy.shape — NumPy v2.4 Manual

    numpy.shape # numpy.shape(a) [source] # Return the shape of an array. Parameters: aarray_like Input array. Returns: shapetuple of ints The elements of the shape tuple give the lengths of the …

  2. NumPy Array Shape - W3Schools

    NumPy arrays have an attribute called shape that returns a tuple with each index having the number of corresponding elements. Print the shape of a 2-D array: The example above returns (2, 4), which …

  3. NumPy Shape and Array Dimensions in Python

    May 8, 2025 · Learn how to use NumPy shape in Python to understand and manipulate array dimensions. Examples with real-world data, reshaping techniques, and common solutions.

  4. Python shape () method - All you need to know! - DigitalOcean

    Aug 3, 2022 · With the shape () method, comes the flexibility to obtain the dimensions of any Python object. Yes, it returns a tuple value that indicates the dimensions of a Python object.

  5. NumPy Array Shape - GeeksforGeeks

    Jul 15, 2025 · The shape of an array can be defined as the number of elements in each dimension. Dimension is the number of indices or subscripts, that we require in order to specify an individual …

  6. arrays - what does numpy ndarray shape do? - Stack Overflow

    Nov 30, 2017 · For a 1D array, the shape would be (n,) where n is the number of elements in your array. For a 2D array, the shape would be (n,m) where n is the number of rows and m is the number of …

  7. Understanding `.shape` in Python - CodeRivers

    Jan 24, 2025 · In Python libraries like NumPy, TensorFlow, and PyTorch, the .shape attribute is used to obtain the dimensions of an array or tensor. It returns a tuple of integers, where each integer …

  8. Python:NumPy | ndarray | .shape | Codecademy

    Oct 30, 2025 · The .shape attribute of a NumPy ndarray returns a tuple of integers specifying the size of the array in each dimension. It provides information about the structure and layout of the array.

  9. How to Get NumPy Array Shape? - Spark By Examples

    Feb 13, 2025 · In this article, I have explained how to get the shape of a Python NumPy array by using numpy.ndarray.shape properties with examples. This returns a tuple with the number of rows and …

  10. Python numpy Array shape - Tutorial Gateway

    The Python numpy module has a shape function, which helps us to find the size of an array or matrix. Apart from this shape function, the Python numpy module has to reshape, resize, transpose, …