Numpy Slicing In Hindi

NumPy Array Slicing – Numpy In Hindi

Numpy

NumPy Array Slicing in Hindi – Numpy In Hindi – Array Slicing Karne Ke Liye Hame Start Or End And Step Number Dena Hota Hai. Ise Ham Example Ke Sath Niche Understand Karne Wale Hain |

What Is Slicing – Slicing Keval List Ya Array Me Se Kisi Start Se Lekar End Tak Number Ko Access Karne Ke Liye Istemal Hoti Hai Or Ham Ise Hi Slicing Kahte Hai |

NumPy Array Slicing in Hindi

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 |

Syntax:

[start:end:step]
  • start :- Jaha Se Hame Number Start Karna Hai.
  • end :- Jaha Tak Hame Number Lena Hai.
  • step :- Start Or End Ke Bich me Kitna Step Dena Hai.

Numpy Array Me Slicing 0 Se start Hota Hai Or Numpy Me Ham Indexing 1-D Array Or 2-D Array And 3-D Array Me, Kar Sakte Hain. Inhe Ham Example Ke Sath Dekhte Hai |

Example 1:

import numpy as np
list_arr = [1,2,3,4,5]
arr = np.array(list_arr)
print(arr[0:5])

Output:

[1, 2, 3, 4, 5]

Aap Upper Output Ko Dekh Sakte Hai Ki Hamne Ek Array Ki Slicing Ki Hai Jisme 0 Se Lekar 5 Tak Input Diya Hai And Uske Bad Aap Output Check Kar Sakte Hain |

Also Read – Create Numpy Arrays Using Functions

Example 2:

import numpy as np
list_arr = [1,2,3,4,5]
arr = np.array(list_arr)
print(arr[3:5])
print(arr[2:])

Output:

[4 5]
[3 4 5]

Negative Slicing in Python In Hindi

Aap Python Me Negative Slicing Bhi Kar Sakte Hai. Negative Slicing Karne Ke Liye Keval Aapko (-) Negative Sign Dena Hota Hai Number Ke Sath |

Example:

import numpy as np
list_arr = [1,2,3,4,5]
arr = np.array(list_arr)
print(arr[-3:-1])
print(arr[-2:])

Output:

[3 4]
[4 5]

Step Slicing in Python In Hindi

Aap Python Me Slicing Ke Sath Me Step ( Yani Start Or End Ke Bich Me Kitne Number Ka Difference Hona Chahiye ) Bhi De Sakte Hai |

Example:

import numpy as np
list_arr = [1,2,3,4,5]
arr = np.array(list_arr)
print(arr[1:5:1])
print(arr[1:5:2])
print(arr[1:5:3])

Output:

[2 3 4 5]
[2 4]
[2 5]

Also Read NumPy Array Indexing

Friends Mujhe Umeed Hai Ki Aapko Numpy Arrays Slicing 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 |

Leave a Reply

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