0
0
Pandasdata~10 mins

What is Pandas - Interactive Quiz & Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to import the pandas library with the common alias.

Pandas
import [1] as pd
Drag options to blanks, or click blank then click option'
Anumpy
Bpandas
Cmatplotlib
Dseaborn
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'numpy' instead of 'pandas'.
Forgetting to use the alias 'pd'.
2fill in blank
medium

Complete the code to create a pandas DataFrame from a dictionary.

Pandas
import pandas as pd

data = {'name': ['Alice', 'Bob'], 'age': [25, 30]}
df = pd.[1](data)
Drag options to blanks, or click blank then click option'
Alist
Barray
CSeries
DDataFrame
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'Series' which creates a one-dimensional array.
Using 'array' or 'list' which are not pandas objects.
3fill in blank
hard

Fix the error in the code to display the first 3 rows of the DataFrame.

Pandas
import pandas as pd

data = {'name': ['Alice', 'Bob', 'Charlie', 'David'], 'age': [25, 30, 35, 40]}
df = pd.DataFrame(data)
print(df.[1](3))
Drag options to blanks, or click blank then click option'
Ahead
Btail
Cfirst
Dshow
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'tail' which shows the last rows.
Using 'first' or 'show' which are not pandas methods.
4fill in blank
hard

Fill both blanks to create a DataFrame and select the 'age' column.

Pandas
import pandas as pd

data = {'name': ['Anna', 'Ben'], 'age': [22, 28]}
df = pd.[1](data)
age_column = df[2]
Drag options to blanks, or click blank then click option'
ADataFrame
BSeries
C['age']
D.age
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'Series' to create the DataFrame.
Using dot notation to select the column which may fail if column name has spaces.
5fill in blank
hard

Fill all three blanks to filter rows where age is greater than 25 and create a new DataFrame.

Pandas
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]()
Drag options to blanks, or click blank then click option'
A>
B25
Ccopy
Dhead
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<' instead of '>'.
Forgetting to use copy() which can cause warnings.
Using head() which returns only first rows.