About 1,240,000 results
Open links in new tab
  1. python - Numpy array dimensions - Stack Overflow

    Jun 22, 2023 · The shape method requires that a be a Numpy ndarray. But Numpy can also calculate the shape of iterables of pure python objects: np.shape([[1,2],[1,2]])

  2. python - how is axis indexed in numpy's array? - Stack Overflow

    Mar 14, 2017 · By definition, the axis number of the dimension is the index of that dimension within the array's shape. It is also the position used to access that dimension during indexing. For example, if a 2D array a has shape (5,6), then you can access a[0,0] up to a[4,5].

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

    Mar 1, 2014 · An array of shape (u,v,M) dotted with an array of shape (w,x,y,M,z) would result in an array of shape (u,v,w,x,y,z). Let's see how this rule looks when applied to In [25]: V = np.arange(2); V Out[25]: array([0, 1]) In [26]: M = np.arange(4).reshape(2,2); M Out[26]: array([[0, 1], …

  4. NumPy: Get the number of dimensions, shape, and size of ndarray

    May 9, 2023 · You can get the number of dimensions, shape (length of each dimension), and size (total number of elements) of a NumPy array (numpy.ndarray) using the ndim, shape, and size attributes. The built-in len() function returns the size of the first dimension.

  5. Numpy Step By Step Guide - GeeksforGeeks

    3 days ago · To understand all the basics of Numpy Arrays - explaining their types (one-dimensional and multi-dimensional), key attributes (axis, shape, rank, dtype): Basics of Numpy Arrays. Section 2: Creating Arrays in Numpy . NumPy arrays are created using the np.array() function, which converts lists, tuples, or other sequences into a NumPy array.

  6. The N-dimensional array (ndarray) — NumPy v2.2 Manual

    ndarray (shape [, dtype, buffer, offset, ...]) An array object represents a multidimensional, homogeneous array of fixed-size items. Arrays can be indexed using an extended Python slicing syntax, array[selection]. Similar syntax is also used for …

  7. Numpy – ndarray - GeeksforGeeks

    Jan 23, 2025 · Understanding the attributes of an ndarray is essential to working with NumPy effectively. Here are the key attributes: ndarray.shape: Returns a tuple representing the shape (dimensions) of the array. ndarray.ndim: Returns the number of dimensions (axes) of the array. ndarray.size: Returns the total number of elements in the array.

  8. Numpy Axes, Explained - Sharp Sight

    Dec 10, 2018 · This tutorial will explain NumPy axes. It will explain how axes work in NumPy arrays, and also show you some examples (with Python code).

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

    numpy.ndarray.shape# attribute. 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 array dimensions to it.

  10. NumPy Array Shape - W3Schools

    Get the Shape of an Array. NumPy arrays have an attribute called shape that returns a tuple with each index having the number of corresponding elements.

  11. Some results have been removed
Refresh