0

I have a pandas dataframe. I want to convert each row a json file without the 'index' information. Is there any pandas/pythonic way?

import pandas as pd
df1 = pd.DataFrame.from_dict({
    'Name': ['Jane', 'Nik', 'Kate', 'Melissa', 'Evan', 'Doug', 'Joe'],
    'Age': [10, 35, 34, 23, 70, 55, 89],
    'Height': [130, 178, 155, 133, 195, 150, 205],
    'Weight': [80, 200, 220, 150, 140, 95, 180]
})



    Name    Age Height  Weight
0   Jane    10  130 80
1   Nik 35  178 200
2   Kate    34  155 220
3   Melissa 23  133 150
4   Evan    70  195 140
5   Doug    55  150 95
6   Joe 89  205 180

For example, from the first row the output should look life following,

{"Name" : "Jane",
"Age" : 10,
...
}

Thank you.

Droid-Bird
  • 1,417
  • 5
  • 19
  • 43

0 Answers0