Category : explode

I have a dataframe like this: enter image description here And I want to do the explode, but it turns this error: enter image description here This is my code: rooms_df = sample_df.explode(‘rooms’)[[‘property_id’, ‘rooms’]] This is the output from df.head(1).to_dict() {‘property_id’: {0: 16455}, ‘rooms’: {0: {‘212101786’: {‘amenities’: {‘1073742603’: {‘id’: ‘1073742603’, ‘name’: ‘テラス’}, ‘1073742816’: {‘id’: ‘1073742816’, ..

Read more

I have a dataframe containing two columns I would like to explode / unnest together. One contains dates, the other contains information related to the dates. here is what the initial df looks like: data = [ ["ABC", 2002, ["AB", "AB", "EF"], ["2002-05-06", "2002-05-07", "2002-05-12"]], ["DEF", 2002, [["CD", "EF"]], ["2002-06-12", "2002-06-13"]], ["GHI", 2002, [["JK"]], ["2002-03-02"]], ..

Read more

I am new in python and pandas and also in stackoverflow so I apologize for any mistakes I make in advance. I have this dataframe df = pd.DataFrame( data=[[‘Donald Trump’, ‘German’, ‘2021-9-23 14:28:00′,’2021-9-23 14:58:00’, 1800 ], [‘Donald Trump’, ‘German’, ‘2021-9-23 14:58:01′,’2021-9-23 15:00:05’, 124 ], [‘Donald Trump’, ‘German’, ‘2021-9-24 10:05:00′,’2021-9-24 10:15:30’, 630 ], [‘Monica Lewinsky’, ‘German’, ..

Read more