Complete the code to create a DataFrame from a dictionary.
import pandas as pd data = {'Name': ['Alice', 'Bob'], 'Age': [25, 30]} df = pd.[1](data) print(df)
The DataFrame constructor creates a table-like structure from a dictionary.
Complete the code to select the 'Age' column from the DataFrame.
import pandas as pd data = {'Name': ['Alice', 'Bob'], 'Age': [25, 30]} df = pd.DataFrame(data) age_column = df[1]['Age'] print(age_column)
Using square brackets [ ] selects a column by name from a DataFrame.
Fix the error in the code to filter rows where Age is greater than 25.
import pandas as pd data = {'Name': ['Alice', 'Bob', 'Charlie'], 'Age': [25, 30, 22]} df = pd.DataFrame(data) filtered = df[df['Age'] [1] 25] print(filtered)
The operator > selects rows where Age is greater than 25.
Fill both blanks to create a dictionary comprehension that maps names to ages for people older than 23.
data = {'Name': ['Alice', 'Bob', 'Charlie'], 'Age': [25, 30, 22]}
result = {data['Name'][i]: data['Age'][i] for i in range(len(data['Name'])) if data['Age'][i] [1] 23}
print(result)The operator > filters ages greater than 23.
Fill all three blanks to create a DataFrame from a list of dictionaries and select rows where score is above 80.
import pandas as pd data = [{'name': 'Alice', 'score': 85}, {'name': 'Bob', 'score': 75}, {'name': 'Cara', 'score': 90}] df = pd.[1](data) high_scores = df[df['[2]'] [3] 80] print(high_scores)
Use DataFrame to create the table, select the 'score' column, and filter with > to get scores above 80.