If tutorials available on this website are helpful for you, please whitelist this website in your ad blocker😭 or Donate to help us ❤️ pay for the web hosting to keep the website running.
Python में defined data types के अलावा numpy में कुछ additional data types भी हैं , जिन्हे array define करते समय define करना पड़ता है।
Data Type का simply मतलब है किसी variable का type, जिससे हमें पता चल सके कि कोई variable किस type की value hold किये हुए है , या in future किस type की value hold करेगा।
Python में built in Data Types कुछ प्रकार हैं -
Python Data Types |
---|
Text : str |
Numeric : int, float, complex |
Sequence : list, tuple, range |
Binary : bytes, bytearray, memoryview |
Mapping : dict |
Set : set, frozenset |
Boolean : bool |
ये तो वो data types थे जिन्हे python support करती है , अब नीचे कुछ data types की list है जिन्हे numpy module support करता है।
data type को set या check करने के लिए , ndarray की एक property dtype होती है , जिससे हमें पता चलता है कि जो array create किया गया है , वो किस type के elements को होल्ड किये हुए है।
#import numpy module.
import numpy as np
#make an array as int type.
arr = np.array([12,12,23,3,445,45, 32])
print(arr.dtype)
#define array with data type.
arr = np.array(["name", "name2", "name3", "other name"], dtype='S')
print(arr.dtype)
C:\Users\Rahulkumar\Desktop\python>python module_numpy.py int64 |S10
Hi ! I'm Rahul Kumar Rajput founder of learnhindituts.com. I'm a software developer having more than 4 years of experience. I love to talk about programming as well as writing technical tutorials and blogs that can help to others. I'm here to help you navigate the coding cosmos and turn your ideas into reality, keep coding, keep learning :)
Get connected with me. :) LinkedIn Twitter Instagram Facebook