NumPy Array Shape And Reshape

NumPy Array Shape And Reshape – Numpy In Hindi

Numpy

NumPy Array Shape And Reshape in HindiNumpy In Hindi – Is Post Me Numpy Shape() And reshape() Function Ke Bare Me Baat Karne Wale Hain |

NumPy Array Shape And Reshape 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 |

Numpy Ke In Dono Function Ko Ham Ek Ek Karke Understand Karte Hai Or Fir Inke Example Bhi Dekh Te Hai.

NumPy Array Shape in Hindi

Shape Function Ka Istemal Numpy Arrays Ke Row And Column Ko Find Karne Ke Liye Istemal Kiya Jata Hai |

Shape Function Return Me Ek Tuple Deta Hai |

Example:

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

Output:

(2, 4)

Example 2:

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

Output:

(1, 1, 3)

NumPy Array Reshape in Hindi

Reshape() Function Ka Istemal Keval shape Ko Reshape Karne Ke Liye Hota Hai Yani Ki reshape Function Old Shape Me Changing Karta Hai |

Example From 1-D Array To 2-D Array:

Hamare Pass Ek 1-D Array Hai Or Usme 10 Elements Hai Ab Hamne reshape Karke bola hai ki 2 Column Or Har Ek Column Me 5 Elements |

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

Output:

[[ 1  2  3  4  5]
 [ 6  7  8  9 10]]

Example2: From 1-D Array To 3D Array

Ham 1-D array se 3-D Array me Convert Karne Wale Hai. Hamare Pass Ek arr 1D Array hai Or Ab Hamne reshape Karke 2 Array Or 3 Column And 2 Row Create Ki Hai |

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

Output:

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

 [[ 7  8]
  [ 9 10]
  [11 12]]]

Aapne Kiya Learn Kiya ?

Is Article Mai Aapne NumPy Array Shape And Reshape Ke Bare Mai Learn Kiya Hai |

Friends Mujhe Umeed Hai Ki Aapko NumPy Shape And Reshape 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 *