Home > database >  Convert Pandas Dataframe from Column with List to Series
Convert Pandas Dataframe from Column with List to Series

Time:10-13

I have a dataframe column that has a list within it. I need to remove the list so that it is a typical series.

Here is what I have:

import pandas as pd

df = pd.DataFrame({'columnA': [['try', 'go', 'spell'], ['you', 'should', 'to']], 'columnB': [['see', 'it', 'now'], ['why', 'not', 'yes']]})

enter image description here

Here is what I need:

df = pd.DataFrame({'columnA': (['try' " "'go' " " 'spell'], ['you' " "  'should' " "  'to']), 'columnB': (['see' " " 'it' " " 'now'], ['why' " "  'not' " "  'yes'])}

enter image description here

CodePudding user response:

Based on your question you can use pandas enter image description here

  • Related