NumPy Array Search in Hindi – Numpy In Hindi

Numpy

NumPy Array Search in HindiNumpy In Hindi – Array Search Ka Istemal Array Me Se Element Ko Find Karke Liye 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 Array Search In Hindi

Array Me Se Agar Aapko Koi Bhi Element Find Karna Hai To, Ya Fir Aapko Condition Laga Ke Kuch Results Nikal na Hai, To Aap Array Ke Search Yani where, searchsorted Function Ka Istemal Kar Sakte Hai.

Sabse Pahle Ham where Function Ka Istemal karte Hai |

Numpy where Function In Hindi

Maine Aapko Pahle Hi Bata Diya Hai, Ki where() Function Ka Istemal Elements Ko Search Karne Ke Liye Kiya Jata Hai, Iska Ham Example Dekhte Hai |

Example 1:

import numpy as np

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

x = np.where(arr == 4)

print(x)

Aap Dekhte Hai, ki Hamne Ek arr Create Kiya Hai, Or Fir Hamne where Function Ka Istemal karke arr == 4 Diya Hai, Yani ki Hamne Kaha Ki arr variable me se Find Karo ki 4 Kitni Position Par Hai, Aap Iska Niche Output Check Kar Sakte Hai |

Output:

(array([3, 5, 6]),)

Aap Dekh Sakte Hai, Ki 3,5,6 Position Par 4 Number Hai, Aap Jante Hai ki Array Ki Position zero Se Start Hoti hai |

Example 2:

import numpy as np

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

x = np.where(arr%2 == 0)

print(x)

Hamne Is Example 2 Program Me ek arr Array Create Kiya Hai Or Fir Hamne where Ki Help se arr%2==0 Condition Lagaya Hai, Iska Matlab Hai , Ki arr Me Se Even Number Find Karke x Me Return Kardo or Fir use Hamne Print Kar Diya Hai |

Output:

(array([1, 3, 5, 7]),)

Numpy searchsorted() Function In Hindi

Numpy Me searchsorted() Function Ka Istemal Isliye Kiya Jata Hai Ki, Agar Hamne searchsorted Function Agar Ek Array Pass Kar Diya Or Fir Hamne, comma Dekar koi Number Pass Kar Diya To searchsorted() Function Usse Pahle Wale, Number Ki Remaining Index Ko Batayega, Iska Ham Example Dekhte Hai |

Example 1:

import numpy as np

arr = np.array([6, 7, 8, 9])

x = np.searchsorted(arr, 7)

print(x)

Hamne Yaha Par searchsorted Function Ko Kaha Ki aap ek arr Lelo Or Fir Batao Ki 7 Number Se Pahle Ki Kitne Number Bache Hai|

Output:

1

Waise Ye Function By Default Left Me Find Karta Hai, Isme Ham Side Bhi De Sakte Hai

Example 2:

arr = np.array([6, 7, 8, 9])

x = np.searchsorted(arr, 7, side='right')

print(x)

Output:

2

Aap Isme Multiple Value Ko Dekar Bhi Find Kar Sakte Hai, Iska Example Niche Diya Gaya Hai.

Example 3:

import numpy as np

arr = np.array([1, 3, 5, 7])

x = np.searchsorted(arr, [2, 4, 6])

print(x)

Output:

[1 2 3]

Iska Matlab Ye Hua Ki, 2 Position Se Pahle 1 Hai, Yani Ki 0 And 1, Kyoki Array Ko Position Zero Se Start Hoti hai, And 4 Position se Pahle 2 Hai, Or 6 Position Se Pahle 3 Elements Hai |

Leave a Reply

Your email address will not be published. Required fields are marked *