Skip to content
Advertisement

python convert single json column to multiple columns

I have a data frame with one json column and I want to split them into multiple columns.

Here is a df I’ve got.

JavaScript

I want the output as below:

JavaScript

I’ve tried

JavaScript

Both didn’t work. can someone please tell me how to get output that I want?

Advertisement

Answer

One way using pandas.DataFrame.explode:

JavaScript

Output:

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement