Complete the code to select the row with label 2 using loc.
row = df.loc[[1]]Using loc selects rows by their label. Here, the label is 2.
Complete the code to select the third row by position using iloc.
row = df.iloc[[1]]iloc selects rows by integer position starting at 0, so the third row is at position 2.
Fix the error in selecting rows 1 to 3 (inclusive) using loc.
subset = df.loc[[1]]loc includes both the start and end labels in slices, so 1:3 selects rows with labels 1, 2, and 3.
Fill both blanks to select rows 0 to 2 by position and columns 'A' and 'B' by label.
subset = df.iloc[[1]].loc[:, [2]]
iloc slice 0:3 selects rows 0,1,2 by position. loc with ['A', 'B'] selects columns by label.
Fill all three blanks to create a dictionary of word lengths for words longer than 3 letters.
lengths = {word: [1] for word in words if [2] [3] 3}We use len(word) to get length, and filter words where length is greater than 3.