0👍
✅
You could solve it like so:
df = df.set_index('month')
out = {'labels': df.index.tolist(), 'datasets': []}
for col in df.columns:
out['datasets'].append({
'label': col,
'data': df[col].values.tolist()
})
Source:stackexchange.com