Complete the code to create a DataFrame from the list of lists named data.
import pandas as pd data = [[1, 'Alice'], [2, 'Bob'], [3, 'Charlie']] df = pd.[1](data)
The DataFrame constructor creates a DataFrame from the list of lists.
Complete the code to assign column names 'ID' and 'Name' to the DataFrame.
import pandas as pd data = [[1, 'Alice'], [2, 'Bob'], [3, 'Charlie']] df = pd.DataFrame(data, columns=[1])
Column names must be given as a list of strings.
Fix the error in the code to create a DataFrame from data with columns 'A' and 'B'.
import pandas as pd data = [[10, 20], [30, 40]] df = pd.DataFrame(data, columns=[1])
The number of column names must match the number of columns in data.
Fill both blanks to create a DataFrame from data and set the index to the first column.
import pandas as pd data = [[101, 'John'], [102, 'Jane'], [103, 'Doe']] df = pd.DataFrame(data, columns=[1]).set_index([2])
Columns are named with a list, and the index is set to the 'ID' column.
Fill all three blanks to create a DataFrame from data, name columns, and select rows where 'Age' is greater than 25.
import pandas as pd data = [[1, 'Anna', 22], [2, 'Ben', 30], [3, 'Cara', 27]] df = pd.DataFrame(data, columns=[1]) adults = df[df[[2]] [3] 25]
Columns are named with a list. We filter rows where 'Age' is greater than 25 using > operator.