I need to send a dataframe from a backend to a frontend and so first need to convert it either to an object that is JSON serialisable or directly to JSON. The problem being that I have some dataframes that don't have unique cols. I've looked into the orient
parameter, to_json()
, to_dict()
and from_dict()
methods but still can't get it to work...
The goal is to be able to convert the df to something json serializable and then back to its initial self.
I'm also having a hard time copy-pasting it using pd.read_clipboard so I've included a sample df causing problems as an image (sorry!).