Skip to main contentSkip to solution

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

(A) Print the series

(B) Import the pandas library

(C) Create the series

(D) Create a dictionary

Solution

✅ Correct Option: 3

(B) Import the pandas library, since pd.Series() is available only after the import.

(D) Create a dictionary, whose keys become the index and whose values become the data.

(C) Create the series by passing the dictionary to pd.Series().

(A) Print the series.


Options 2 and 4: the series is created before the dictionary exists or before pandas is imported, which gives an error.

Keyboard Shortcuts

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