0
0
Data Analysis Pythondata~20 mins

Why Python is the top choice for data analysis in Data Analysis Python - Challenge Your Understanding

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Python Data Analysis Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Why is Python popular for data analysis?

Which of the following reasons best explains why Python is widely used for data analysis?

APython has a large number of libraries like pandas and NumPy that simplify data manipulation and analysis.
BPython is the fastest programming language available for all types of computing tasks.
CPython requires no installation and runs only in web browsers.
DPython automatically understands data without any coding.
Attempts:
2 left
💡 Hint

Think about tools that help with handling data easily.

Predict Output
intermediate
2:00remaining
Output of Python code using pandas

What is the output of this Python code snippet?

Data Analysis Python
import pandas as pd

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

print(df['Age'].mean())
ATypeError
B28.0
C30.0
D28.5
Attempts:
2 left
💡 Hint

Calculate the average of the ages: 28, 34, and 22.

data_output
advanced
2:00remaining
Result of filtering data with pandas

Given the DataFrame below, what is the output after filtering rows where 'Score' is greater than 80?

Data Analysis Python
import pandas as pd

data = {'Student': ['John', 'Jane', 'Dave', 'Dana'], 'Score': [75, 82, 90, 60]}
df = pd.DataFrame(data)

filtered_df = df[df['Score'] > 80]
print(filtered_df)
A
  Student  Score
1    Jane     82
2    Dave     90
B
  Student  Score
0    John     75
3    Dana     60
C
  Student  Score
1    Jane     82
3    Dana     60
D
Empty DataFrame
Columns: [Student, Score]
Index: []
Attempts:
2 left
💡 Hint

Keep only rows where Score is more than 80.

visualization
advanced
2:00remaining
Interpreting a Python matplotlib plot

What does the following Python code plot?

Data Analysis Python
import matplotlib.pyplot as plt

x = [1, 2, 3, 4]
y = [10, 20, 25, 30]

plt.plot(x, y, marker='o')
plt.title('Sales Over Time')
plt.xlabel('Quarter')
plt.ylabel('Sales (in thousands)')
plt.show()
AA pie chart showing sales distribution.
BA line graph showing sales increasing over four quarters with points marked.
CA scatter plot with no connecting lines.
DA bar chart showing sales for four quarters.
Attempts:
2 left
💡 Hint

Look at the plot type and markers used.

🔧 Debug
expert
2:00remaining
Identify the error in this Python data analysis code

What error will this code produce when run?

Data Analysis Python
import pandas as pd

data = {'A': [1, 2, 3], 'B': [4, 5, 6]}
df = pd.DataFrame(data)

result = df['C'].sum()
print(result)
A0
BTypeError: unsupported operand type(s) for +: 'int' and 'str'
CKeyError: 'C'
DAttributeError: 'DataFrame' object has no attribute 'sum'
Attempts:
2 left
💡 Hint

Check if the column 'C' exists in the DataFrame.