I am creating a Python dictionary from a dataframe and the results contain a few thousand entries;
oxford_english = df.set_index('id')['name'].to_dict()
# Example result:
{12345: 'companyA'}
I need to convert the dictionary by changing the current keys and values into the following format:
{"id": "12345", "name": "CompanyA"}
I know how to change values and keys in a dictionary but I can't figure out how to split the entries into new key value pairs.
The reason for all of this is because I need to pass the dictionary as JSON to a Web API.
Any suggestions?