Complete the code to import the pandas library with the common alias.
import [1] as pd
The pandas library is imported using the name 'pandas'. The common alias is 'pd'.
Complete the code to create a pandas DataFrame from a dictionary.
import pandas as pd data = {'name': ['Alice', 'Bob'], 'age': [25, 30]} df = pd.[1](data)
Use pd.DataFrame() to create a DataFrame from a dictionary.
Fix the error in the code to display the first 3 rows of the DataFrame.
import pandas as pd data = {'name': ['Alice', 'Bob', 'Charlie', 'David'], 'age': [25, 30, 35, 40]} df = pd.DataFrame(data) print(df.[1](3))
The head() method shows the first rows of a DataFrame. Use head(3) to show the first 3 rows.
Fill both blanks to create a DataFrame and select the 'age' column.
import pandas as pd data = {'name': ['Anna', 'Ben'], 'age': [22, 28]} df = pd.[1](data) age_column = df[2]
Create a DataFrame with pd.DataFrame() and select the 'age' column using df['age'].
Fill all three blanks to filter rows where age is greater than 25 and create a new DataFrame.
import pandas as pd data = {'name': ['Tom', 'Jerry', 'Mickey'], 'age': [20, 27, 30]} df = pd.DataFrame(data) adults = df[df['age'] [1] [2]] result = adults.[3]()
Use df['age'] > 25 to filter rows where age is greater than 25. Then use copy() to create a new DataFrame.