# Numpy in Hindi – Creating Arrays – ndarray

Numpy in HindiPython Creating Arrays in HindiNumpy Arrays Ke Sath Kaam Karta Hai. Array Object Ko Ham Numpy Me ndarray Kahte Hai |

Yadi Aapne  HTML Full Course  And CSS Full Course And Python Full Course And PHP Full Course Nhi Read Kiya Hai To Aap Vah Bhi Read Kar Sakte Hai |

## Numpy Creating Arrays

Contents

Numpy Me Arrays Ko Create Karne Ke Liye array() Function Ka Istemal Karna Hota Hai.

Waise Sabse Pahle Numpy Ko Import Karna Hoga And Import Karne Ke Liye Aapko import numpy as np likhna hoga |

Example:

ndarray Ko Create Karne Ke Liye Ham Ek List Or Tuple Bhi Create Kar Sakte Hai or Fir Us List Or Tuple Ko array() Function Pass Kar Dete Hai Or Uske Bad numpy.array() Function ndarray Me Convert Kar Deta Hai |

```import numpy as np
list_np = [1,2,3,4]   #python list
arr = np.array(list_np)
print(arr)```

Output:

`[1 2 3 4]`

Check Data Type Usind Type Function

```import numpy as np
list_np = [1,2,3,4]   #python list
arr = np.array(list_np)
print(type(arr))```

Output:

`<class 'numpy.ndarray'>`

type() function Return Me Data Type Print Karta Hai Jaise Ki Upper Example Me Dikhaya Gaya Hai |

## Types Of Dimensions in Arrays

Arrays Me Dimensions Koi Types Ke Hote Hai And Inka Istemal Alag Alag Tarike Se Hota Hai.

Types Of Dimensions Ko Ab Ham Ek Ek Karke Dekhne Wale Hai.

### 0-Dimension Array

0-D arrays, Or Scalars Matrix Ye Elements Hai array Ke Or 0-D Array Me Har Ek Value 0-D Array Hoti Hai |

Example:

```import numpy as np
arr - np.array(30)
print(arr)```

Output:

`30`

### 1-Dimension Array

Ab Ham 1-D Array Ka Example Dekhte Hai | [1-D Array]

Example:

```import numpy as np
arr = np.array([45,5,64,56])
print(arr)```

Output:

`[45  5 64 56]`

### 2-Dimension Array

[[1-D Array],[1-D Array]] = [[2-D Array ]]

Example:

```import numpy as np
arr = np.array([[45,5,64,56],[4,55,4,6]])
print(arr)```

Output:

```[[45  5 64 56]
[ 4 55  4  6]]```

### 3-Dimension Array

[[[ 3-D Array ]]]

Also Read – NumPy – Introduction

Example:

```import numpy as np
arr = np.array([[[1,2,3,4],[5,6,7,8],[1,2,3,4],[5,6,7,8]]])
print(arr)```

Output:

```[[[1 2 3 4]
[5 6 7 8]
[1 2 3 4]
[5 6 7 8]]]```

### N-Dimension Array

Agar Hame Kuch Jyada Hi Dimension Ko Create Karna Hai To Aap ndmin Function Ka Istemal Karke Kar Sakte Hai |

Example:

```import numpy as np
arr = np.array([1,2,3,4] , ndmin=4)
print(arr)```

Output:

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

## Check Number of Dimensions?

Dimensions Number Ko Check Karna Ho To Ham ndim Function se Kar Sakte Hai |

Example:

```import numpy as np

a = np.array(42)
b = np.array([1, 2, 3, 4, 5])
c = np.array([[1, 2, 3], [4, 5, 6]])
d = np.array([[[1, 2, 3], [4, 5, 6]], [[1, 2, 3], [4, 5, 6]]])

print(a.ndim)
print(b.ndim)
print(c.ndim)
print(d.ndim)```

Output:

```0
1
2
3```

Also Read – NumPy – Environment + Setup + Anaconda

Friends Mujhe Umeed Hai Ki Aapko Numpy Array in Hindi Ke Bare Mai 100% Jankari Ho Gayi Hogi | Agar Aapko Learn Karne Main Dikkat Aa Rahi Hai To Aap Mere Se Contact Kar Sakte Hai |