NumPy Data Types in Hindi – Numpy In Hindi – Is Post Me Ham Python Data Types Ko Learn Karne Wale Hai Jo Numpy Me Istemal Hoti 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 Data Types in Hindi
Contents
Waise Data Types Ka Istemal Lagbhag Har Programming Language Me Hota Hai. Lekin Ham Is Post Me Numpy Data Types Ko Dekhne Wale Hai Wo Example Ke Sath. Let See..
Python Me Data Types 5 Type Ke Hote Hai. Jo Niche Diye Gaye Hai.
strings
– used to represent text data, the text is given under quote marks. eg. “ABCD”integer
– used to represent integer numbers. eg. -1, -2, -3float
– used to represent real numbers. eg. 1.2, 42.42boolean
– used to represent True or False.complex
– used to represent a number in complex plain. eg. 1.0 + 2.0j, 1.5 + 2.5j
Aap Jo Upper Data Types Dekh Rahe Hai Wo Python Ke Data Types Hai Lekin Ab Ham Numpy Ke Data Types Ko Dekhne Wale Hain.
Data Types in NumPy in Hindi
Numpy Me Kuch Data Types Extra Hai. Joki Niche List Me Diye Gaye Hai Or Unko Istemal Karne Ke Liye Bhi Character Diye Gaye Hai.
i
– integerb
– booleanu
– unsigned integerf
– floatc
– complex floatm
– timedeltaM
– datetimeO
– objectS
– stringU
– unicode stringV
– fixed chunk of memory for other type ( void )
Ab Ham Ek Ek Karke In Data Types Ko Example Ke Sath Dekhte Hain |
Also Read – Create Numpy Arrays Using Functions
Checking the Data Type of an Array
Sabse Pahle Agar Hame Koi Array Ke Data Ka Data Types Check Karna Ho to Ham dtype Function Se Check Karte Hai.
Example 1:
import numpy as np list_arr = [1,2,3,4,5] arr = np.array(list_arr) print(arr.dtype)
Output:
int32
Example 2:
import numpy as np arr = np.array(['apple', 'banana', 'cherry']) print(arr.dtype)
Output:
<U6
Creating Arrays With a Defined Data Type
Arrays Ko Create Karte Time Ham Data Type Bhi Defined Kar Sakte Hai And Data Type Define Karne Ke Liye dtype Function Ka Istemal karna Hoga. Ise Ham Example Ke Sath Understand Karte Hai.
Example:
import numpy as np strng = np.array([1,2,3],dtype='S') print(strng)
Output:
array([b'1', b'2', b'3'], dtype='|S1')
Also Read – NumPy Array Indexing
Data Type Defined Karne Ke Sath Sath Ham Size Bhi Defined Kar Sakte Hai.
Example:
import numpy as np strng = np.array([1,2,3],dtype='i4') print(strng)
Output:
array([1, 2, 3])
Convert Data Type Using astype Functions in Numpy
Numpy Me Ham Data Type Ko Bhi Convert Kar Sakte Hai. Data Type Ko Convert karne Ke Liye astype Function Ka Istemal Karna Hoga |
Example:
Change Float Data Type To Int Data Type
import numpy as np list_arr = [1.1,2.2,3.3,4.4,5.5] arr = np.array(list_arr) arr_int = arr.astype('i') #i for int print(arr_int)
Output:
array([1, 2, 3, 4, 5], dtype=int32)
Also Read – NumPy Array Slicing
Friends Mujhe Umeed Hai Ki Aapko Numpy Arrays Data Types 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 |