Pandas split column of lists into multiple columns

后端 未结 8 1676
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-21 06:28

I have a pandas DataFrame with one column:

import pandas as pd

df = pd.DataFrame(
    data={
        \"teams\": [
            


        
8条回答
  •  我寻月下人不归
    2020-11-21 07:13

    There seems to be a syntactically simpler way, and therefore easier to remember, as opposed to the proposed solutions. I'm assuming that the column is called 'meta' in a dataframe df:

    df2 = pd.DataFrame(df['meta'].str.split().values.tolist())
    

提交回复
热议问题