1

I have a simple, empty dataframe.

import pandas as pd
data_table = pd.DataFrame(columns=['ID', 'Name', 'Description'])

Now i read a json file and with it I am creating a list of dictionary.
There are houndreds of dictionaries in that list which look something like this

{'id':'1', 'name':'some_name', 'description': 'some description'}
{'id':'2', 'name':'other_name', 'description': 'other description'}

I tried pushing all those dictionaries into my data_table variable but every way I tried, all the shapes or the indexes were messed up.

Scott Boston
  • 133,446
  • 13
  • 126
  • 161
Zusman
  • 546
  • 4
  • 22

1 Answers1

0

Base on you description all dict in a list

youdf=pd.concat([pd.Series(x) for x in l],1).T
youdf
         description id        name
0   some description  1   some_name
1  other description  2  other_name 

Data input

l=[{'id':'1', 'name':'some_name', 'description': 'some description'},
{'id':'2', 'name':'other_name', 'description': 'other description'}]
BENY
  • 296,997
  • 19
  • 147
  • 204