Dtype <U7 meaning

Hello,



In the below array(studentdata), what does dtype '<U7' means ?



>>> studentdata = np.array([["Bela", 2014, 75.2], ["Suressh", 2014, 65.4], ["Ramesh", 2014, 85.3]])



>>> studentdata.dtype

dtype('<U7')

 

Hi Kanika,



Please try to run the code below after your student.dtype:



studentdata.dtype.name,studentdata.dtype.itemsize,studentdata.dtype.descr



And please go through the 'Attributes' section at the bottom of  first link below:



Array dtypes



And also through the link below:

nump dtype descr





In summary, basically the descriptor you got doesn't mean much. And the actual data structure for your array is described by the name and itemsize attribute of dtype. For these two results are:

 

('str224', 28)

meaning data type for each element of your array is a 
        string of length 224 bits or 28 bytes.

Thanks Ashish! It helped.