0
0
Data Analysis Pythondata~10 mins

Aggregation functions (sum, mean, std) in Data Analysis Python - Interactive Code Practice

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

Complete the code to calculate the sum of the 'sales' column in the DataFrame.

Data Analysis Python
total_sales = df['sales'].[1]()
Drag options to blanks, or click blank then click option'
Asum
Bstd
Cmean
Dcount
Attempts:
3 left
💡 Hint
Common Mistakes
Using mean() instead of sum() to add values.
Using std() which calculates spread, not total.
2fill in blank
medium

Complete the code to find the average (mean) of the 'age' column.

Data Analysis Python
average_age = df['age'].[1]()
Drag options to blanks, or click blank then click option'
Astd
Bsum
Cmin
Dmean
Attempts:
3 left
💡 Hint
Common Mistakes
Using sum() without dividing by count.
Using std() which measures spread, not average.
3fill in blank
hard

Fix the error in the code to calculate the standard deviation of the 'height' column.

Data Analysis Python
height_std = df['height'].[1]()
Drag options to blanks, or click blank then click option'
Asum
Bstd
Cmedian
Dmean
Attempts:
3 left
💡 Hint
Common Mistakes
Using mean() or sum() instead of std().
Using median() which finds the middle value, not spread.
4fill in blank
hard

Fill both blanks to create a dictionary with word lengths for words longer than 4 characters.

Data Analysis Python
lengths = {word: [1] for word in words if len(word) [2] 4}
Drag options to blanks, or click blank then click option'
Alen(word)
B>
C<
Dword
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<' instead of '>' causing wrong filtering.
Using 'word' instead of 'len(word)' for length.
5fill in blank
hard

Fill all three blanks to create a 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'
Ak.upper()
Bv
C>
Dk.lower()
Attempts:
3 left
💡 Hint
Common Mistakes
Using k.lower() instead of k.upper() for keys.
Using '<' instead of '>' in the filter condition.