Skip to main contentSkip to solution

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

✅ Correct Option: 1

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.

Keyboard Shortcuts

  • Left arrow: Previous question
  • Right arrow: Next question
  • S key: Jump to solution
  • Q key: Jump to question