0

I have a list of lists of data that have values and titles mixed up. This is an example of the list:

[{'id': 1132020, 'from': 1607472600, 'at': 1607472660024394207, 'to': 1607472660, 'open': 1.21094, 'close': 1.21096, 'min': 1.21093, 'max': 1.21097, 'volume': 18}, {'id': 1160021, 'from': 1607472660, 'at': 1607472720024366554, 'to': 1607472720, 'open': 1.21096, 'close': 1.21097, 'min': 1.21094, 'max': 1.21097, 'volume': 9}]

However, I want to create a Pandas Dataset with this information. I have tried to do what was described here https://stackoverflow.com/a/42418234/14790671, but was unable to successfully get the dataset. Any help is welcome, thank you.

Joaquin
  • 45
  • 1
  • 4

1 Answers1

0

The code below will do the thing you want. Check each line so you can understand the code and know "how to" in the future. Better use a console to see the results at the same time. (I use Pycharm console for that, it's really helpful)

import pandas as pd

lst_of_dicts = [{'id': 1132020, 'from': 1607472600, 'at': 1607472660024394207, 'to': 1607472660, 'open': 1.21094, 'close': 1.21096, 'min': 1.21093, 'max': 1.21097, 'volume': 18}, {'id': 1160021, 'from': 1607472660, 'at': 1607472720024366554, 'to': 1607472720, 'open': 1.21096, 'close': 1.21097, 'min': 1.21094, 'max': 1.21097, 'volume': 9}]

df = pd.DataFrame(lst_od_dicts)
print(df)