Complete the code to convert the 'age' column to integer type.
df['age'] = df['age'].[1]('int')
The astype() method is used to convert the data type of a pandas Series or DataFrame column.
Complete the code to convert the 'price' column to float type.
df['price'] = df['price'].[1]('float')
Use astype('float') to convert a column to float type in pandas.
Complete the code to convert the 'score' column to string type.
df['score'] = df['score'].[1]('str')
str instead of the string 'str'.The astype() method requires the type as a string like 'str', not the Python str type directly.
Fill both blanks to create a new column 'is_adult' with boolean type based on 'age' >= 18.
df['is_adult'] = (df['age'] [1] 18).[2]('bool')
Use the comparison operator >= to check if age is at least 18, then convert the result to boolean with astype('bool').
Fill both blanks to create a dictionary with word lengths for words longer than 3 characters.
lengths = {word: [1] for word in words if len(word) [2] 3}The dictionary comprehension uses : to separate keys and values, len(word) to get the length, and > to filter words longer than 3 characters.