Splitting dictionary/list inside a Pandas Column into Separate Columns

后端 未结 12 1451
南方客
南方客 2020-11-22 02:50

I have data saved in a postgreSQL database. I am querying this data using Python2.7 and turning it into a Pandas DataFrame. However, the last column of this dat

12条回答
  •  时光取名叫无心
    2020-11-22 03:37

    I strongly recommend the method extract the column 'Pollutants':

    df_pollutants = pd.DataFrame(df['Pollutants'].values.tolist(), index=df.index)

    it's much faster than

    df_pollutants = df['Pollutants'].apply(pd.Series)

    when the size of df is giant.

提交回复
热议问题