Complete the code to import the pandas library with the common alias.
import [1] as pd
We use import pandas as pd to import pandas with the alias pd. This is the standard way to use pandas in Python.
Complete the code to create a DataFrame from a dictionary.
data = {'Name': ['Alice', 'Bob'], 'Age': [25, 30]}
df = pd.[1](data)Use pd.DataFrame() to create a DataFrame from a dictionary. This structure is like a table with rows and columns.
Fix the error in the code to display the first 3 rows of the DataFrame.
df.[1](3)
The head() method shows the first rows of a DataFrame. Here, df.head(3) shows the first 3 rows.
Fill both blanks to create a dictionary comprehension that maps words to their lengths only if length is greater than 3.
{word: [1] for word in words if [2] > 3}We use len(word) to get the length of each word. The condition checks if the length is greater than 3.
Fill all three blanks to create a dictionary from data items where values are positive.
result = [1]: [2] for [1] , [2] in data.items() if [2] [3] 0}
We use k and v as variable names for keys and values. The condition v > 0 filters positive values.