Question: given a list of dicts:

```
import pandas as pd
d =[{'foil': ['a', 'b', 'c']},
{'car': ['b', 'c','d','e']},
{'container': ['e','f','g','h','i','j']}]

df=pd.DataFrame()
for c in d:
    print(c)
    word   = list(c.keys())[0]
    values = c[word]

    df[word] = pd.Series(values, name=word)
df

```

I would like to build a dataframe where the name of every column is foil, car and container and the values are the ones of the list.

The problem when looping like above is that the result is:
[![enter image description here](https://i.stack.imgur.com/pjI83.png)](https://i.stack.imgur.com/pjI83.png)

But I would like to have all the values, if needed the shorter columns might be filled with NAN (and afterwards changing the NAN to '')

Looping over every dict and adding values to the list up to the max(length) of the lists seems to me very cumbersome.

Any more pythonic way?

Answer: 
You may check `concat` the result with for loop

```
out = pd.concat([pd.DataFrame(x) for x in d],axis=1)
Out[534]: 
  foil  car container
0    a    b         e
1    b    c         f
2    c    d         g
3  NaN    e         h
4  NaN  NaN         i
5  NaN  NaN         j

```
One can use [`ChainMap`](https://docs.python.org/3/library/collections.html#collections.ChainMap) to merge the dictionaries and the DataFrame constructor:

```
from collections import ChainMap
c = ChainMap(*d)
df = pd.DataFrame(c.values(), index=c).T

```

Or, in line with the nice answer of @not\_speshal,

```
from collections import ChainMap
df = pd.DataFrame.from_dict(ChainMap(*d), orient="index").T

```

Output:

```
  container  car foil
0         e    b    a
1         f    c    b
2         g    d    c
3         h    e  NaN
4         i  NaN  NaN
5         j  NaN  NaN

```