I am a bit new to Python programming. I have a small requirement where in I need to list down all customers and their amounts for a given fortnight in a JSON format.Currently, I have a dataframe this way -
FortNight AmountValue Customer
2018-04-29 339632.00 10992
2018-04-29 27282.00 10994
2018-04-29 26353.00 10995
2018-04-29 24797.00 11000
2018-04-29 21093.00 10990
Expected -
"Apr-2FN-2018":[
{"Customer":"10992","AmountValue":"339632.00"},
{"Customer":"10994","AmountValue":"27282.00"},
{"Customer":"10995","AmountValue":"26353.00"},
{"Customer":"11000","AmountValue":"24797.00"},
{"Customer":"10990","AmountValue":"21093.00"}
]
I tried using
df.(orient = "records", date_format = "iso")
But it retrieves values in the below way-
{"FortNight":"2018-04-29T00:00:00.000Z","AmountValue":21093.8,"Customer":10990}
I tried other ways too, but in vain. Any help is welcome. Thanks in advance!!...