Python: Pandas dataframe from Series of dict

后端 未结 2 1983
误落风尘
误落风尘 2020-11-29 10:23

I have a Pandas dataframe:

type(original)
pandas.core.frame.DataFrame

which includes the series object original[\'user\']:

相关标签:
2条回答
  • 2020-11-29 10:39

    df = original['user'].apply(pd.Series)

    works well

    credit

    0 讨论(0)
  • 2020-11-29 10:53

    what I would try to do is the following:

    new_df = pd.DataFrame(list(original['user']))
    

    this will convert the series to list then pass it to pandas dataframe and it should take care of the rest.

    0 讨论(0)
提交回复
热议问题