• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home ยป Resolved: Convert a dictionary to pandas dataframe

Resolved: Convert a dictionary to pandas dataframe

0
By Isaac Tonny on 16/06/2022 Issue
Share
Facebook Twitter LinkedIn

Question:

I have a dictionary in which values are odict_items:
When I convert it to a dataframe the output is as follows:
df = pd.DataFrame(dict.values())
But the desired output is as follows (first column is the key and the next columns are values in odict_items):
Any help would be appreciated.

Answer:

You need to reconstruct valid dictionaries from the items:
Output:
Used input:

If you have better answer, please add a comment about this, thank you!

dataframe dictionary ordereddictionary pandas python
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: Passing 2 functions in onChange in react

24/03/2023

Resolved: Why doesn’t stringstream consume output during hex formatting?

24/03/2023

Resolved: CMake path for python3 libraries doesn’t change (windows 10)

24/03/2023

Leave A Reply

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.