Find Numpy array dimensions
Shape attribute of numpy can be used to find dimensions of numpy array easily.
# Imports
import numpy as np
# Let's create a numpy array
nparray = np.array([[1,2,5],[3,4,6]])
# Check dimensions
print(nparray.shape)
(2, 3)
Related Resources:
- Create Vector in Python | Numpy Tutorial Create a Vector Create a Vector in Python using numpy array objects and reshape method. Vectors are backbone of math...
- Reverse Numpy array | Various strategies Reverse Numpy arrays Reverse 1 dimensional numpy arrays using reverse slicing [ : :-1] Reverse N dimensional numpy arrays row wise using...
- Read csv file to numpy array Read csv file to numpy array Use “savetxt” method of numpy to save a numpy array to csv file Use...
- Save Numpy array to csv file Save Numpy array to csv file Most machine learning engineers and Data Scientists use Numpy array because it’s efficient and...
- Reshape Numpy array | Numpy Tutorial Reshape Numpy Array Reshape numpy array with “reshape” method of numpy library. Reshaping numpy array is useful to convert array...
- Create array with Random numbers | Numpy tutorial Create array with Random Numbers Create array with Random Numbers with random module of Numpy library. In this Numpy tutorial...
- Numpy Arange Create an Array | Numpy tutorial Numpy Arange Use numpy arange method to create array with sequence of numbers. In the below example we create an...
- Get value from index in Numpy array | Numpy tutorial Value from Index in Numpy Get value from index in numpy array using python like slicing. In below examples we...
- Concatenate Numpy arrays | Join Numpy arrays Concatenate Numpy arrays Learn how to concatenate numpy arrays in various ways. “concatenate” method to join Numpy arrays “hstack” to...
- Convert an Array to one dimensional vector Convert an Array to One dimensional Vector | Flatten Convert an Array to One dimensional Vector with flatten method of...