Complete the code to create a structured array with fields 'name' and 'age'.
import numpy as np person = np.array([('Alice', 25), ('Bob', 30)], dtype=[1])
The dtype must define the fields with correct types: 'name' as Unicode string of length 10 and 'age' as 4-byte integer.
Complete the code to access the 'age' field from the structured array.
ages = person[1]To get the 'age' field from a structured array, use the field name as a key: person['age'].
Fix the error in the code to create a structured array with fields 'city' and 'population'.
cities = np.array([('Paris', 2148327), ('Berlin', 3769495)], dtype=[1])
The 'city' field should be a Unicode string type to hold city names, and 'population' an integer type.
Fill both blanks to create a structured array and access the 'score' field.
data = np.array([(1, 95.5), (2, 88.0)], dtype=[1]) scores = data[2]
The dtype defines 'id' as integer and 'score' as float. To get scores, access data['score'].
Fill all three blanks to create a structured array, filter by age, and get names.
people = np.array([
('Anna', 28),
('Tom', 22),
('Mike', 35)
], dtype=[1])
adults = people[people[2] 25]
names = adults[3]The dtype defines 'name' and 'age'. Filter adults by age > 25 using people['age'] > 25. Then get their names with adults['name'].