NumPy libraries help us with using arrays in Python with the help of array object called “ndarray”. Using array() function, we can create ndarray objects.

We can create various dimensional arrays using “ndarray”. Let’s see them all with an example.

**1. **__A. Creating a 0-D array:__

Syntax:

# creating 0-D array

arr = np.array(53)

print(arr)

Output:

` 53`

B. __Checking the dimension of array:__

Using “[variablename].ndim” , find the dimension of an array.

Syntax:

# creating 0-D array

arr = np.array(53)

print(arr)

#checking dimensions

print(arr.ndim)

Output:

` 53`

0

C. __Checking the shape of an array:__

Using “[variablename].shape”, find the shape of an array.

Syntax:

# creating 0-D array

arr = np.array(53)

print(arr)

#checking dimensions

print(arr.ndim)

#shape of an array

print ('shape of array:', arr. shape)

Output:

` 53`

` 0`

` shape of array: () ---- since it’s a 0-dimensional array, there is no number displayed in it.`

**2. **__Creating a 1-D array, checking the dimension and shape of the 1-D array:__

1 | 2 | 3 | 4 | 5 |

__ __

__Syntax:__

# creating 1-D array

arr1 = np.array([1, 2, 3, 4, 5])

print(arr1)

#checking dimensions

print(arr1.ndim)

#shape of an array

print('shape of array :', arr1.shape)

__Output:__

`[1 2 3 4 5]`

`1`

`shape of array: (5,) --- This shows the array is having 1 dimension and `

`the first dimension has 5 elements.`

**3. **__Creating a 2-D array, checking the dimension and shape of the 2-D array:__

1 | 2 | 3 | 4 | 5 |

6 | 7 | 8 | 9 | 4 |

__Syntax:__

# creating 2-D array

arr2 = np.array([[1, 2, 3, 4, 5],[6,7,8,9,4]])

print(arr2)

#checking dimensions

print(arr2.ndim)

#shape of an array

print('shape of array :', arr2.shape)

__Output:__

`[[1 2 3 4 5]`

` [6 7 8 9 4]]`

`2`

`shape of array : (2, 5) – `

`This shows that 2 values inside a bracket represent it has 2 dimensions. `

`First dimension (row) has 2 values, `

`and the second dimension(column) has 5 values.`

**4. **__Creating a 3-D array, checking the dimension and shape of the 3-D array:__

__Syntax:__

# creating 3-D array

arr3 = np.array([[[1, 2, 3, 4, 5],[6,7,8,9,4]],[[1, 2, 3, 4, 5],[6,7,8,9,4]]])

print(arr3)

#checking dimensions

print(arr3.ndim)

#Shape of an array

print('shape of array :', arr3.shape)

__Output:__

`[[[1 2 3 4 5]`

` [6 7 8 9 4]]`

` `

` [[1 2 3 4 5]`

` [6 7 8 9 4]]]`

`3`

`shape of array : (2, 2, 5)`

`This shows that 3 values inside a bracket represent it has 3 dimensions. `

`First dimension (i=number of sheets) has 2 sheets`

`second dimension (j=row) has 2 values, `

`and the third dimension(k=column) has 5 values.`

**5. **__Creating a 4-D array, checking the dimension and shape of the 4-D array:__

__Syntax:__

# creating 4-D array

arr4 = np.array([[[[1, 2, 3, 4, 5],[6,7,8,9,4]],[[1, 2, 3, 4, 5],[6,7,8,9,4]]],[[[1, 2, 3, 4, 5],[6,7,8,9,4]],[[1, 2, 3, 4, 5],[6,7,8,9,4]]]])

print(arr4)

#checking dimensions

print(arr4.ndim)

#Shape of an array

print('shape of array :', arr4.shape)

__Output:__

`[[[[1 2 3 4 5]`

` [6 7 8 9 4]]`

` `

` [[1 2 3 4 5]`

` [6 7 8 9 4]]]`

` `

` `

` [[[1 2 3 4 5]`

` [6 7 8 9 4]]`

` `

` [[1 2 3 4 5]`

` [6 7 8 9 4]]]]`

`4`

`shape of array : (2, 2, 2, 5)`

`This shows that 4 values inside a bracket represent it has 4 dimensions. `

`First dimension(r=number of arrays)has 2 arrays`

`Second dimension (i=number of sheets) has 2 sheets in each array`

`Third dimension (j=row) has 2 values, `

`and the Fourth dimension(k=column) has 5 values.`

This is how we find the shape of an array in Python. Try doing different shapes and find its values.

**Happy Analyzing!**

Are you in search of a reliable

? Look no further! Our service stands out as the ultimate solution for students grappling with academic tasks. We understand the complexities of academia and offer tailored assistance to ease your burden. Whether it's a challenging essay, a research-intensive paper, or a perplexing project, our team of experienced professionals is here to support you every step of the way. Committed to excellence and timely delivery, we ensure that your assignments not only meet but exceed expectations. Our dedicated support team is available round the clock to address any queries or concerns you may have. Trust us to deliver exceptional quality and help you achieve academic success. Don't let assignments overwhelm…assignment helper in AustraliaAssignment Help Services in Chicagoserve as valuable resources for students seeking academic support and guidance. By leveraging the expertise of professionals and tutors, students can overcome challenges, excel in their studies, and achieve their academic goals in the vibrant academic landscape of Chicago.