0
0
Data Analysis Pythondata~20 mins

Why DataFrame is the core data structure in Data Analysis Python - Challenge Your Understanding

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
DataFrame Mastery Badge
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Why is a DataFrame considered the core data structure in data analysis?

Choose the best reason why DataFrame is central to data analysis tasks.

AIt allows storing data in rows and columns, making it easy to manipulate and analyze structured data.
BIt is a tool used only for visualizing data, not for storing or manipulating it.
CIt is a simple list that stores only numbers for fast calculations.
DIt stores data as plain text files without any structure.
Attempts:
2 left
💡 Hint

Think about how you work with tables in real life, like spreadsheets.

Predict Output
intermediate
2:00remaining
What is the output shape of this DataFrame?

Given the code below, what is the shape (rows, columns) of the resulting DataFrame?

Data Analysis Python
import pandas as pd

data = {'Name': ['Anna', 'Bob', 'Cara'], 'Age': [28, 34, 29], 'City': ['NY', 'LA', 'SF']}
df = pd.DataFrame(data)
print(df.shape)
A(1, 3)
B(3, 2)
C(3, 3)
D(2, 3)
Attempts:
2 left
💡 Hint

Count the number of rows and columns in the data dictionary.

data_output
advanced
2:00remaining
What is the output of filtering this DataFrame?

What rows remain after filtering the DataFrame for Age > 30?

Data Analysis Python
import pandas as pd

data = {'Name': ['Anna', 'Bob', 'Cara', 'Dan'], 'Age': [28, 34, 29, 40]}
df = pd.DataFrame(data)
filtered = df[df['Age'] > 30]
print(filtered)
A
Empty DataFrame
Columns: [Name, Age]
Index: []
B
   Name  Age
1   Bob   34
3   Dan   40
C
   Name  Age
0  Anna   28
1   Bob   34
2  Cara   29
3   Dan   40
D
   Name  Age
0  Anna   28
2  Cara   29
Attempts:
2 left
💡 Hint

Look for rows where Age is greater than 30.

visualization
advanced
2:00remaining
Which plot best shows the distribution of ages in this DataFrame?

Given a DataFrame with ages, which plot type best visualizes the age distribution?

Data Analysis Python
import pandas as pd
import matplotlib.pyplot as plt

data = {'Age': [22, 25, 29, 22, 30, 25, 28, 29, 30, 22]}
df = pd.DataFrame(data)

# Assume the plot is created here
AHistogram showing frequency of each age group
BLine plot connecting ages in order
CScatter plot with Age on x-axis and index on y-axis
DPie chart showing percentage of each age
Attempts:
2 left
💡 Hint

Think about how to show how many times each age appears.

🔧 Debug
expert
2:00remaining
What error does this DataFrame operation raise?

What error occurs when running this code?

Data Analysis Python
import pandas as pd

data = {'Name': ['Anna', 'Bob'], 'Age': [28, 34]}
df = pd.DataFrame(data)

# Attempt to access a non-existent column
print(df['Salary'])
AValueError
BTypeError
CIndexError
DKeyError
Attempts:
2 left
💡 Hint

Check what happens when you try to access a column that is not in the DataFrame.