Pandas - Create dataframe with only one row from dictionary with array of integers Pandas - Create dataframe with only one row from dictionary with array of integers arrays arrays

Pandas - Create dataframe with only one row from dictionary with array of integers


Wrap the values in a list:

pd.DataFrame({k: [v] for k, v in d.items()})#             val_1   val_2#0  [1, 2, 3, 4, 5]       4


You can start with pd.Series instead:

pd.Series(d).to_frame().T             val_1 val_20  [1, 2, 3, 4, 5]     4


You can using

df=pd.DataFrame(columns=d.keys())df.append(d, ignore_index=True)Out[26]:              val_1 val_20  [1, 2, 3, 4, 5]     4