I have the following code (Python 2.7):
response2 = requests.get(...)
sample_object = pd.DataFrame(response2.json())['results'].to_dict()
This creates a dict from my DataFrame and I'm creating a Json from it However it is not sorted:
How can I sort it by key? meaning isGift
before ShippingAddress_city
etc...
I saw privious answers like this but I can't manage to do it in my code...
tried also to_dict(into=ordered)
but nothing happens.
Is there an easy way to sort it from the start? Or must I sort it only after creation and if so how do I do that?