Which of the following is correct way to create a pandas 'Series' from a list?
Which of the following is correct way to create a pandas 'Series' from a list?
Solution
✅ Correct Option: 1
pd.Series() is the pandas constructor for a Series. Passing a list to it creates a one-dimensional labelled array, with a default index added automatically.
Option 2: pd.DataFrame() also accepts a list, but it returns a two-dimensional DataFrame, not a Series.
Option 3: pandas has no ListSeries function.
Option 4: the order is reversed. Series belongs to the pandas module (pd.Series), so Series.pandas is invalid.
Remember: Series starts with a capital S, and pd.series() in lowercase gives an error.
Related questions:
2026: 29 May Shift 2
2025: 27 May Shift 2
2025: 13 May Shift 2