0
0
Data Analysis Pythondata~10 mins

Series arithmetic and alignment 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 add two pandas Series s1 and s2.

Data Analysis Python
result = s1 [1] s2
Drag options to blanks, or click blank then click option'
A+
B/
C*
D-
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-' instead of '+' causes subtraction.
Using '*' or '/' will multiply or divide instead of adding.
2fill in blank
medium

Complete the code to subtract Series s2 from s1.

Data Analysis Python
result = s1 [1] s2
Drag options to blanks, or click blank then click option'
A+
B-
C*
D/
Attempts:
3 left
💡 Hint
Common Mistakes
Using '+' adds instead of subtracting.
Using '*' or '/' changes the operation to multiply or divide.
3fill in blank
hard

Fix the error in the code to multiply two Series s1 and s2 element-wise.

Data Analysis Python
result = s1 [1] s2
Drag options to blanks, or click blank then click option'
A+
B-
C/
D*
Attempts:
3 left
💡 Hint
Common Mistakes
Using '+' or '-' changes the operation to addition or subtraction.
Using '/' divides instead of multiplying.
4fill in blank
hard

Fill both blanks to create a new Series with squares of values from s for indices where values are greater than 3.

Data Analysis Python
result = {word: s[word][1]2 for word in s.index if s[word] [2] 3}
Drag options to blanks, or click blank then click option'
A**
B>
C<
D*
Attempts:
3 left
💡 Hint
Common Mistakes
Using '*' instead of '**' does multiplication, not power.
Using '<' instead of '>' filters wrong values.
5fill in blank
hard

Fill all three blanks to create a dictionary of index labels in uppercase with their values, filtering values less than 5.

Data Analysis Python
result = [1]: [2] for [3], val in s.items() if val < 5}}
Drag options to blanks, or click blank then click option'
Aidx.upper()
Bval
Cidx
Ditem
Attempts:
3 left
💡 Hint
Common Mistakes
Using item instead of idx causes undefined variable error.
Using val as key or idx.upper() as loop variable causes errors.