About 240,000 results
Open links in new tab
  1. NumPy Array Shape - GeeksforGeeks

    Dec 28, 2023 · In this example, two NumPy arrays arr1 and arr2 are created, representing a 2D array and a 3D array, respectively. The shape of each array is printed, revealing their …

  2. numpy.ndarray.shape — NumPy v2.2 Manual

    ndarray. shape # Tuple of array dimensions. The shape property is usually used to get the current shape of an array, but may also be used to reshape the array in-place by assigning a tuple of …

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

  4. python - How to make numpy array with 2D shape - Stack Overflow

    Feb 2, 2018 · You can use zip to transpose at python (non-numpy) level: >>> a = [1, 2, 3, 4] >>> >>> *zip(a), ((1,), (2,), (3,), (4,)) >>> >>> import numpy as np >>> np.array([*zip(a)]) array([[1], …

  5. Create a 2D NumPy Array in Python (5 Simple Methods) - Python

    May 9, 2025 · This tutorial explains how to create a 2D NumPy array in Python using six different methods like, array(), zeros(), ones(), full(), random(), and arange() with reshape() function. …

  6. Create 2D Array in NumPy - Python Examples

    Learn how to create a 2D array in Python using NumPy. Explore various methods like array(), zeros(), ones(), and empty() to easily initialize 2D arrays with different values and shapes.

  7. NumPy: Get the dimensions, shape, and size of an array

    Apr 23, 2025 · You can get the number of dimensions, the shape (length of each dimension), and the size (total number of elements) of a NumPy array (numpy.ndarray) using the ndim, shape, …

  8. Python | Using 2D arrays/lists the right way - GeeksforGeeks

    Jun 20, 2024 · Using 2D arrays/lists the right way involves understanding the structure, accessing elements, and efficiently manipulating data in a two-dimensional grid. By mastering the use of …

  9. Array creation — NumPy v2.2 Manual

    The 2D array creation functions e.g. numpy.eye, numpy.diag, and numpy.vander define properties of special matrices represented as 2D arrays. np.eye(n, m) defines a 2D identity matrix. The …

  10. How to Shape and Size of Array in Python - Delft Stack

    Mar 4, 2025 · In this article, we will explore the shape() and size() functions of the NumPy package, which are essential for determining the structure and size of arrays. Whether you’re …

Refresh