Series of lists to one Series
Write a pandas program to turn a Series of lists into one flat Series.
[["Sqa", "tool"], ["Learning", "python"], ["Is", "fun"]]
0 Sqa 1 tool 2 Learning 3 python 4 Is 5 fun dtype: str
Approach
explode()puts each list item on its own row.
Solution
import pandas as pds = pd.Series([["Sqa", "tool"], ["Learning", "python"], ["Is", "fun"]])print(s.explode().reset_index(drop=True))0 Sqa 1 tool 2 Learning 3 python 4 Is 5 fun dtype: str
Learn the concept
New to this topic? Read the lesson, then come back.