Complete the code to import the pandas library with its common alias.
import [1] as pd
We use import pandas as pd to import the pandas library with the alias pd, which is a common practice for easier code writing.
Complete the code to read a CSV file named 'data.csv' into a DataFrame.
df = pd.[1]('data.csv')
The function pd.read_csv() reads a CSV file into a pandas DataFrame.
Fix the error in the code to save the DataFrame 'df' to a CSV file named 'output.csv' without the index.
df.to_csv('output.csv', [1]=False)
The parameter index=False tells pandas not to write row numbers to the CSV file.
Fill both blanks to create a reproducible random sample of 10 rows from DataFrame 'df'.
sample_df = df.sample(n=[1], random_state=[2])
We use n=10 to select 10 rows and random_state=42 to make the sampling reproducible.
Fill all three blanks to create a dictionary comprehension that maps each word to its length only if the length is greater than 3.
lengths = { [1]: [2] for [3] in words if len([3]) > 3 }The comprehension uses word as the key, len(word) as the value, and iterates over word in words.