Complete the code to create a DataFrame from the dictionary.
import pandas as pd data = {'name': ['Alice', 'Bob'], 'age': [25, 30]} df = pd.[1](data) print(df)
Use pd.DataFrame() to create a DataFrame from a dictionary.
Complete the code to create a DataFrame with specified columns order.
import pandas as pd data = {'name': ['Alice', 'Bob'], 'age': [25, 30]} df = pd.DataFrame(data, columns=[1]) print(df)
Specify columns order by passing a list of column names to columns parameter.
Fix the error in the code to create a DataFrame from a dictionary of lists.
import pandas as pd data = {'name': ['Alice', 'Bob'], 'age': [25, 30]} df = pd.DataFrame([1]) print(df)
Pass the dictionary directly to pd.DataFrame(). Using data.items() or others will cause errors.
Fill both blanks to create a DataFrame from a dictionary and select only the 'age' column.
import pandas as pd data = {'name': ['Alice', 'Bob'], 'age': [25, 30]} df = pd.[1](data) age_column = df[[2]] print(age_column)
Create DataFrame with pd.DataFrame() and select column by its name as a string.
Fill all three blanks to create a DataFrame from a dictionary, rename columns, and print the new DataFrame.
import pandas as pd data = {'name': ['Alice', 'Bob'], 'age': [25, 30]} df = pd.[1](data) df.columns = [[2], [3]] print(df)
Create DataFrame with pd.DataFrame(), then rename columns by assigning a list of new names to df.columns.