TourEiffel
TourEiffel

Reputation: 4434

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 :

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.

Upvotes: 0

Views: 35

Answers (1)

rhug123
rhug123

Reputation: 8778

Try:

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

Upvotes: 1

Related Questions