Consider the following statement:
seriesTenTwenty=pd.Series(np.arange(10, 20, 1))
Based on the above statement, arrange the following in ascending order according to the number of values in their result.
A. seriesTenTwenty.count()
B. seriesTenTwenty.head()
C. seriesTenTwenty.head(2)
D. print(seriesTenTwenty)
Consider the following statement:
seriesTenTwenty=pd.Series(np.arange(10, 20, 1))
Based on the above statement, arrange the following in ascending order according to the number of values in their result.
A. seriesTenTwenty.count()
B. seriesTenTwenty.head()
C. seriesTenTwenty.head(2)
D. print(seriesTenTwenty)
Solution
The series holds the 10 values from 10 to 19. Counting the values in each result gives:
A. seriesTenTwenty.count(): 1 value, the single number 10 (the count of non-null entries)
C. seriesTenTwenty.head(2): 2 values, the first two entries
B. seriesTenTwenty.head(): 5 values, since head() returns 5 rows by default
D. print(seriesTenTwenty): 10 values, the whole series
count() returns one number, not a Series, so it is the smallest result even though it is computed from all 10 entries.
Related questions:
2025: 20 May Shift 1
2025: 14 May Shift 1
2026: 29 May Shift 1
2025: 30 May Shift 2
2026: 21 May Shift 1