Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to load data from a CSV file using pandas.
Data Analysis Python
import pandas as pd data = pd.[1]('data.csv')
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using non-existent functions like load_csv or open_csv.
Trying to use Python's open() instead of pandas read_csv.
✗ Incorrect
The pandas function to read CSV files is read_csv.
2fill in blank
mediumComplete the code to remove rows with missing values from the DataFrame.
Data Analysis Python
clean_data = data.[1]() Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using fillna() which fills missing values instead of removing rows.
Using non-existent methods like remove_na or cleanna.
✗ Incorrect
The dropna() method removes rows with missing values.
3fill in blank
hardFix the error in the code to calculate the average of the 'age' column.
Data Analysis Python
average_age = data['age'].[1]()
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using sum() which adds values but does not average.
Using count() which counts non-missing values.
✗ Incorrect
The mean() method calculates the average value of a column.
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 '>' to filter words.
Using 'word' instead of len(word) for the dictionary values.
✗ Incorrect
We use len(word) to get length and '>' to filter words longer than 3.
5fill in blank
hardFill all three blanks to create a dictionary of uppercase keys and values greater than zero.
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() for keys.
Using '<' instead of '>' for filtering values.
✗ Incorrect
We convert keys to uppercase, keep values, and filter values greater than zero.