Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to load a CSV file into a DataFrame using pandas.
Data Analysis Python
import pandas as pd df = pd.[1]('data.csv')
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using read_excel instead of read_csv
Trying to call DataFrame directly without reading the file
✗ Incorrect
The read_csv function loads CSV files into a pandas DataFrame.
2fill in blank
mediumComplete the code to display the first 5 rows of the DataFrame.
Data Analysis Python
print(df.[1]())
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using tail() which shows the last rows
Using info() which shows summary info, not rows
✗ Incorrect
The head() method shows the first 5 rows by default.
3fill in blank
hardFix the error in the code to get summary statistics of the DataFrame.
Data Analysis Python
summary = df.[1]() Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using info() which shows data types, not statistics
Using summary() or stats() which do not exist
✗ Incorrect
The describe() method returns summary statistics like mean and std.
4fill in blank
hardFill both blanks to create a dictionary of word lengths for words longer than 3 characters.
Data Analysis Python
lengths = {word: [1] for word in words if len(word) [2] 3} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using < instead of > in the condition
Using word instead of len(word) for the value
✗ Incorrect
We use len(word) to get length and filter words with length greater than 3 using >.
5fill in blank
hardFill all three blanks to create a filtered dictionary with uppercase keys and values greater than 0.
Data Analysis Python
result = {{ [1]: [2] for k, v in data.items() if v [3] 0 }} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using k.lower() instead of k.upper()
Using < instead of > in the condition
Swapping keys and values
✗ Incorrect
Keys are converted to uppercase with k.upper(), values are v, and filtered where v > 0.