I have a Pandas DataFrame with two columns – one with the filename and one with the hour in which it was generated:
DataFrame
File Hour F1
I think what the OP is looking for is:
with open('temp.json', 'w') as f: f.write(df.to_json(orient='records', lines=True))
This should do the trick.