1

I have pandas dataframe that look like the following

Location   ,   time , Details
Basement-L1  , 03/02/2020 11:00  , {"id": "XXXX", "eventTime": XXX, "Type": "YYY", "PersonName_id": "YYYY-XXXX"}
Basement-L2  ,  03/02/2020 11:01    , {"id": "XXX", "eventTime": YXX, "Type": "YY", "PersonName_id": "YYY-XXX"}

I would like to create other dataframe that will be like this:

Location   ,   time , Details, id, eventTime, Type , PersonName_id
Basement-L1  , 03/02/2020 11:00  , XXXX,  XXX, YYY, YYYY-XXXX
Basement-L2  ,  03/02/2020 11:01    , XXX,  YXX, YY,  YYY-XXX

How I can do this in a fast way without using for loop?

Alex
  • 6,610
  • 3
  • 20
  • 38
HH____HH
  • 75
  • 6

1 Answers1

0

If the objects are dictionaries:

df = df.join(pd.DataFrame(df.pop("Details").tolist()))
Alex
  • 6,610
  • 3
  • 20
  • 38