Complete the code to create a DataFrame from a list of tuples.
df = spark.createDataFrame([1], ['name', 'age'])
The createDataFrame method expects a list of tuples representing rows.
Complete the code to select the 'age' column from the DataFrame.
ages = df.select([1])To select a column by name, pass the column name as a string.
Fix the error in the code to filter rows where age is greater than 30.
filtered = df.filter(df.age [1] 30)
Use the > operator to filter rows where age is greater than 30.
Fill both blanks to create a dictionary comprehension that maps each word to its length if length is greater than 3.
{word: [1] for word in words if [2]The dictionary comprehension maps each word to its length, filtering words longer than 3 characters.
Fill all three blanks to create a dictionary comprehension that maps uppercase words to their lengths if length is greater than 4.
{ [1]: [2] for word in words if [3] }This comprehension creates a dictionary with uppercase words as keys and their lengths as values, filtering words longer than 4 characters.