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
To transform a dataFrame in a real json (not a string) I use:
from io import StringIO import json import DataFrame buff=StringIO() #df is your DataFrame df.to_json(path_or_buf=buff,orient='records') dfJson=json.loads(buff)