Complete the code to select columns 'A' and 'B' from the DataFrame df.
selected = df[[[1]]]To select multiple columns in pandas, you pass a list of column names inside double brackets.
Complete the code to select columns 'Name' and 'Age' from the DataFrame data.
subset = data[[[1]]]Use a list of column names inside double brackets to select multiple columns.
Fix the error in selecting columns 'X' and 'Y' from df.
result = df[[1]]To select multiple columns, use a list of column names inside double brackets.
Fill both blanks to create a dictionary with words as keys and their lengths as values, but only for words longer than 4 letters.
lengths = { [1] : [2] for word in words if len(word) > 4 }The dictionary comprehension uses the word as the key and its length as the value.
Fill all three blanks to create a dictionary with uppercase words as keys, their lengths as values, but only for words longer than 3 letters.
result = { [1] : [2] for word in words if [3] > 3 }The dictionary comprehension uses the uppercase word as key, length as value, and filters words longer than 3 letters.