Splitting dictionary/list inside a Pandas Column into Separate Columns

后端 未结 12 1453
南方客
南方客 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:33

    my_df = pd.DataFrame.from_dict(my_dict, orient='index', columns=['my_col'])

    .. would have parsed the dict properly (putting each dict key into a separate df column, and key values into df rows), so the dicts would not get squashed into a single column in the first place.

提交回复
热议问题