Skip to main contentSkip to solution

Arrange the following statements to create a series from a list.

(A) Define a list

(B) Import pandas library

(C) Display the series

(D) Create the series

Solution

✅ Correct Option: 3

(B) Import pandas library, since the Series class is available only after pandas is imported (for example, import pandas as pd).

(A) Define a list, for example data = [10, 20, 30].

(D) Create the series from the list, for example s = pd.Series(data).

(C) Display the series, for example print(s).


Options 2 and 4: display the series before it is created, which gives an error.

Keyboard Shortcuts

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