Complete the code to select the row with label 'b' using loc.
selected_row = df.loc[[1]]Using df.loc['b'] selects the row labeled 'b' from the DataFrame.
Complete the code to select the 'Age' column for the row labeled 'c'.
age_value = df.loc[[1], 'Age']
df.loc['c', 'Age'] selects the value in the 'Age' column for the row labeled 'c'.
Fix the error in the code to select rows labeled 'a' to 'c' inclusive.
subset = df.loc[[1]]Using df.loc['a':'c'] selects rows with labels from 'a' to 'c' inclusive.
Note: ['a', 'b', 'c'] also works but is a list of labels, while 'a':'c' is a slice.
Fill both blanks to select the 'Name' and 'Age' columns for rows labeled from 'b' to 'd' inclusive.
subset = df.loc[[1], [2]]
df.loc['b':'d', ['Name', 'Age']] selects rows from 'b' to 'd' and columns 'Name' and 'Age'.
Fill both blanks to create a dictionary comprehension that maps each word to its length only if the length is greater than 3.
lengths = {word: {BLANK_2}} for word in words if {{BLANK_2}}The dictionary comprehension syntax is {key: value for item in iterable if condition}.
Here, key is word, value is len(word), and condition is len(word) > 3.