Complete the code to define a structured dtype with fields 'name' as string and 'age' as integer.
dtype = np.dtype([('name', [1]), ('age', 'i4')])
The field 'name' is a string of length 10, so we use 'U10' for Unicode string of length 10.
Complete the code to create a structured dtype with fields 'height' as float and 'weight' as float.
dtype = np.dtype([('height', [1]), ('weight', 'f8')])
Both 'height' and 'weight' are floats with 8 bytes, so 'f8' is used.
Fix the error in the dtype definition to correctly define 'id' as integer and 'score' as float.
dtype = np.dtype([('id', 'i4'), ('score', [1])])
The 'score' field should be a float type, so 'f4' (32-bit float) is correct.
Fill both blanks to define a structured dtype with 'date' as 10-character string and 'temperature' as 64-bit float.
dtype = np.dtype([('date', [1]), ('temperature', [2])])
'date' is a Unicode string of length 10, so 'U10' is used. 'temperature' is a 64-bit float, so 'f8' is used.
Fill all three blanks to create a structured dtype with 'city' as 15-char string, 'population' as 32-bit int, and 'area' as 32-bit float.
dtype = np.dtype([('city', [1]), ('population', [2]), ('area', [3])])
'city' is a Unicode string of length 15 ('U15'), 'population' is a 32-bit integer ('i4'), and 'area' is a 32-bit float ('f4').