हिंदी

What do you understand by rank of an ndarray?

Advertisements

प्रश्न

What do you understand by rank of an ndarray?

लघु उत्तरीय
Advertisements

उत्तर

The rank of an ndarray means the number of dimensions (axes) present in the array. It tells us whether the array is one-dimensional, two-dimensional, three-dimensional, and so on.

  • A 1-dimensional array has rank 1.
  • A 2-dimensional array has rank 2.
  • A 3-dimensional array has rank 3.
import numpy as np
a = np.array([[1, 2], [3, 4]])
print(a.ndim)

Output:

2

Therefore, the rank of the given ndarray is 2.

shaalaa.com
  क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
अध्याय 6: Introduction to NumPy - Exercise [पृष्ठ ११३]

APPEARS IN

एनसीईआरटी Informatics Practices [English] Class 11
अध्याय 6 Introduction to NumPy
Exercise | Q 3. | पृष्ठ ११३
Advertisements
Share
Notifications



      Forgot password?
Use app×