October 2019
Beginner to intermediate
674 pages
16h 43m
English
Structured arrays are slightly different from ndarrays. Each field in a structured array can be of a different data type. For more information on structured arrays, refer to the following: http://docs.scipy.org/doc/numpy/user/basics.rec.html.
The following is an example of a structured array:
memberData = np.array([('Sanjeev',37,162.4),('Yingluck',45,137.8),('Emeka',28,153.2),('Amy',67,101.3)],dtype = [('Name','a15'),('Age','i4'),('Weight','f4')])
This structured array has three fields for which the data types have been defined in a list of tuples along with the field names. The same DataFrame function can be used to construct a DataFrame function from a structured array:
memberDF = pd.DataFrame(memberData)
Take a ...
Read now
Unlock full access