Md Wasi
Md Wasi

Reputation: 503

How to insert values into DataFrames from multiple dictionary objects in Python Pandas

I've so many dictionary objects like

l= {'A':14,'B':45,'C':'ds'}
S= {'A':58,'B':78,'C':'rt'}  ..... so on

I want to take these values of multiple dictionaries into one DataFrame having same column names.

Upvotes: 2

Views: 37

Answers (1)

jezrael
jezrael

Reputation: 862511

Simpliest is create list of dicts and pass to DataFrame constructor:

df = pd.DataFrame([l,S])
print (df)
    A   B   C
0  14  45  ds
1  58  78  rt

Upvotes: 2

Related Questions