Completed
Series — Operations
Questions From This Challenge
Q1mcq1 mark
By default, how many elements does the head() method return when called on a Series with no argument?
5 ✓
10
1
All elements
Q2mcq1 mark
What does s.tail(3) return for a Series s?
The last 3 elements of the Series ✓
The first 3 elements of the Series
The 3 elements with the highest values
The middle 3 elements of the Series
Q3mcq1 mark
If s1 = pd.Series([1, 2, 3], index=['a', 'b', 'c']) and s2 = pd.Series([10, 20, 30], index=['a', 'b', 'c']), what value appears at index 'b' in s1 + s2?
22 ✓
20
2
33
Q4mcq1 mark
When two Series with different index labels are added and a label exists in only one of them, what value appears at that label's position in the result?
NaN ✓
0
The value from whichever Series has it
An error is raised
Q5mcq1 mark
Which arithmetic operator performs element-wise (true) division between two Pandas Series of equal length?
/ ✓
//
%
~
Q6mcq1 mark
What is the effect of executing s * 3, where s is a Pandas Series of numbers?
Every element of s is multiplied by 3 ✓
Only the first element of s is multiplied by 3
It raises a TypeError since a Series cannot be multiplied by a scalar
The Series' elements are repeated 3 times end-to-end
Q7mcq1 mark
Which method call returns only the first 5 elements of a Series s without needing to pass any argument?
s.head() ✓
s.tail()
s.first(5)
s.top()
Q8mcq1 mark
If a Series s has 8 elements and s.tail() is called with no arguments, how many elements are returned?
5 ✓
8
3
1
Q9output1 mark
What is the output of adding two Series that share the same index labels?
import pandas as pd s1 = pd.Series([1, 2, 3], index=['a', 'b', 'c']) s2 = pd.Series([10, 20, 30], index=['a', 'b', 'c']) print(s1 + s2)
Correct output:
a 11
b 22
c 33
dtype: int64Q10output1 mark
What is the output of subtracting two Series that share the same index labels?
import pandas as pd s1 = pd.Series([50, 60, 70], index=['a', 'b', 'c']) s2 = pd.Series([5, 10, 15], index=['a', 'b', 'c']) print(s1 - s2)
Correct output:
a 45
b 50
c 55
dtype: int64Q11output1 mark
What is the output of multiplying a Series by a scalar value?
import pandas as pd s = pd.Series([2, 4, 6, 8]) print(s * 3)
Correct output:
0 6
1 12
2 18
3 24
dtype: int64Q12output1 mark
What is the output of dividing one Series by another, element-wise?
import pandas as pd s1 = pd.Series([10, 20, 30]) s2 = pd.Series([2, 5, 3]) print(s1 / s2)
Correct output:
0 5.0
1 4.0
2 10.0
dtype: float64Q13output1 mark
What is the output of adding two Series whose index labels only partially overlap?
import pandas as pd s1 = pd.Series([1, 2, 3], index=['a', 'b', 'c']) s2 = pd.Series([10, 20, 30], index=['b', 'c', 'd']) print(s1 + s2)
Correct output:
a NaN
b 12.0
c 23.0
d NaN
dtype: float64Q14output1 mark
What is the output of calling head() with no argument on a Series with 7 elements?
import pandas as pd s = pd.Series([11, 22, 33, 44, 55, 66, 77]) print(s.head())
Correct output:
0 11
1 22
2 33
3 44
4 55
dtype: int64Q15output1 mark
What is the output of calling tail(3) on a Series with 8 elements?
import pandas as pd s = pd.Series([1, 2, 3, 4, 5, 6, 7, 8]) print(s.tail(3))
Correct output:
5 6
6 7
7 8
dtype: int64