NumPy Array Split In Hindi -Numpy In Hindi

Numpy

Numpy In Hindi – NumPy Array split In Hindi – array_split Function Ka Istemal Array Ko Split Yani Divide Karne Ke 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 Split In Hindi

Aap Numpy Array Ko Split Bhi kar Sakte Hai, Iska Istemal Han Jab Karte Hai, Jaha Par Hame split Ki Jarurat Hoti Hai, Ise Ham Example Ke Sath Dekhte Hai |

Numpy Me Split Karne Ke Liye array_split Function Ka Istemal Kiya Jata Hai.

Example 1:

import numpy as np

arr = np.array([1, 2, 3, 4, 5, 6])
newarr = np.array_split(arr, 3)
print(newarr)

Aap Upper Dekh Sakte Hai, Hamne Ek 1D Array Create Kiya Hai And Fir Hamne array_split(arr,3 Line Me Divide Kiya Hai ), Iska Output Aap Niche Dekh Sakte Hai |

Output:

[array([1, 2]), array([3, 4]), array([5, 6])]

Example 2:

import numpy as np

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

newarr = np.array_split(arr, 3)

print(newarr[0])
print(newarr[1])
print(newarr[2])

Ab Hamne array_split Karke , Fir Array Ko Index Wise Print Kara Rahe Hai, Iska Output Aap Niche Dekh Sakte Hai |

Output:

[1 2]
[3 4]
[5 6]

Example 3:

import numpy as np

arr = np.array([[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12]])
newarr = np.array_split(arr, 3)
print(newarr)

Ab Hamne 2D Array Liya Hai, Isme Ham Split Karke 3 Line Me Divide Kar Rahe Hai, Iska Output Aap Niche Dekh Sakte Hai |

Output:

[array([[1, 2],
       [3, 4]]), array([[5, 6],
       [7, 8]]), array([[ 9, 10],
       [11, 12]])]

Example 4:

import numpy as np

arr = np.array([[1, 2, 3], 
                [4, 5, 6], 
                [7, 8, 9], 
                [10, 11, 12],
                [13, 14, 15],
                [16, 17, 18]])

newarr = np.array_split(arr, 3, axis=1)

print(newarr)

Ab Hamne 2D Array Ko Axis Wise Split Kar Rahe Hai, Iska Output Aap Dekh Sakte Hai, Waise Axis=1 Ka Matlab Row Hota Hai split Function me.

Output:

[array([[ 1],
       [ 4],
       [ 7],
       [10],
       [13],
       [16]]), array([
       [ 2],
       [ 5],
       [ 8],
       [11],
       [14],
       [17]]), array([
       [ 3],
       [ 6],
       [ 9],
       [12],
       [15],
       [18]])]

Example 5:

import numpy as np

arr = np.array([[1, 2, 3], 
                [4, 5, 6], 
                [7, 8, 9], 
                [10, 11, 12],
                [13, 14, 15],
                [16, 17, 18]])
newarr = np.hsplit(arr, 3)
print(newarr)

Jaise Hamne Axis=1 Ka Istemal Kiya Tha, Waise Hi Ham hsplit Ka Istemal kar Sakte Hai, Ye Same Axis=1 Jaisa Kaam Karta Hai.

Output:

[array([[ 1],
       [ 4],
       [ 7],
       [10],
       [13],
       [16]]), array([
       [ 2],
       [ 5],
       [ 8],
       [11],
       [14],
       [17]]), array([
       [ 3],
       [ 6],
       [ 9],
       [12],
       [15],
       [18]])]

Leave a Reply

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