This is the sample dataset
datetime 2017-12-24 2017-12-31
a 1.5 0.5
b 0.0 1.5
c 1.5 0.0
I'm converting this to json using to_json and i get this output
{"2017-12-24":{"a":1.5,"b":0.0,"c":1.5},"2017-12-31":{"a":0.5,"b":1.5,"c":0.0}}
What i'm trying to do is to get json a list of dict like this
[{"datetime":"2017-12-24","a":1.5,"b":0.0,"c":1.5},{"datetime":"2017-12-31", "a":0.5,"b":1.5,"c":0.0}]
my code is here
df = pd.DataFrame({'2017-12-24': [1.5, 0.0, 1.5], '2017-12-31': [0.5, 1.5, 0.0]}, index=['a', 'b', 'c'])
df.columns.name='datetime'
print(df.to_json())