Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Not able to convert dict as pandas dataframe

I have the following dict :

enter image description here

My goal is to convert it as a dataframe :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Tenor Type Rate
EDH3 Comdty 310 DY FUTURE_RATE 3.84000000
EDM3 Comdty 401 DY FUTURE_RATE 3.71999999

Doing the following give me a non wanted ouput.

EDH3 Comdty EDM3 Comdty
0 {‘Tenor’: ‘310 DY’, ‘Type’: ‘FUTURE_RATE’, ‘Rate’: 3.84000000} {‘Tenor’: ‘401 DY’, ‘Type’: ‘CASH’, ‘Rate’: 3.71999999}

Below is what I did try :

pd.DataFrame(results.items())

The keys should be the index in the wanted output.

>Solution :

Try:

pd.DataFrame(df['Value'].tolist(),index = df['Key'])
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading