# NumPy Filter Array in Hindi

NumPy Filter Array in Hindi – Numpy Filter Ka Istemal Array Yani Ki List Ko Filter Karne Ke Liye Istemal Kiya Jata 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 Filter Array in Hindi

Numpy Me Filter Karne Ke Koi Tarike Hai, Jiske Through Aap Array Ko FIlter Kar Sakte Hai, Ham Ek Post Me Ek Ek karke Example Dekhte Hai Or Us Example Ko Understand Karte Hai |

Example 1:

```import numpy as np

arr = np.array([41, 42, 43, 44])

x = [True, False, True, False]

newarr = arr[x]

print(newarr)```

Is Example 1: Hamne Ek Arr Creae Kiya Hai Or Uske Bad Hamne x List Ke Under True , False , True , False Diya Hai Or Uske Bad Line number 7 Me Hamne newarr variable ko arr[x] Assign Kar Diya Hai, Iska Matlab Hai Ki Hamne Yaha Par Filter Lagaya Hai Wo Bhi Boolean Ki help Se, Matlab Jaha Par True Hoga Waha Ki Vale Aa Jayegi, Jaise arr me 41,43 par True Hai, To Ye Value newarr Me Assign Ho Jayengi |

Output:

`[41 43]`

Example 2:

```import numpy as np

arr = np.array([41, 42, 43, 44])

# Create an empty list
filter_arr = []

# go through each element in arr
for element in arr:
# if the element is higher than 42, set the value to True, otherwise False:
if element > 42:
filter_arr.append(True)
else:
filter_arr.append(False)

newarr = arr[filter_arr]

print(filter_arr)
print(newarr)```

Hamne Example 2: Me Ek arr Create Kiya Hai, Or Uske Bad ek Variable filter_arr[] Empty Create Kiya Hai, Uske Bad Hamne Ek For Loop Ko Lagaya Hai Or Uske Under Ek Condition Lagaya Hai Ki Agar 42 se Koi Element Bada ( element > 42: ) To Wo filter_arr. append Me Add Ho Jaye last me, Nhi To False Ho Jaye, Uskebad Fir hamne newarr Ko arr[filter_arr] assign Kar DIya Hai |

Output:

```[False, False, True, True]
[43 44]```