Complete the code to filter rows where the 'Name' column contains the substring 'John'.
filtered = df[df['Name'].str.[1]('John')]
The str.contains method checks if the string contains the given substring anywhere.
Complete the code to filter rows where the 'Email' column contains the pattern '@gmail.com' ignoring case.
filtered = df[df['Email'].str.contains('@gmail.com', case=[1])]
Setting case=False makes the search ignore uppercase or lowercase differences.
Fix the error in the code to filter rows where 'City' contains 'York' using regex.
filtered = df[df['City'].str.contains('York', regex=[1])]
The regex parameter expects a boolean value, not a string or integer.
Fill both blanks to create a dictionary of word lengths for words longer than 4 characters.
lengths = {word: [1] for word in words if len(word) [2] 4}The dictionary comprehension maps each word to its length if the word length is greater than 4.
Fill all three blanks to create a dictionary of uppercase words with their lengths if length is greater than 3.
result = [1]: [2] for w in words if len(w) [3] 3}
The dictionary comprehension uses the uppercase word as key, length as value, and filters words longer than 3.