0

I have a dictionary of the following form:

original_dict = {'a': {'col1': 1, 'col2': 2, 'col3': 5}, 'b': {'col2': 8}, 'c': {'col4': 1} }

the actual number of keys is 8000 and the lengths of the value dicts range from 2 to 8000.

I want to turn it into a pandas df (of size (8000,8000)) such that for the example above the df would look like:

  col1 col2 col3 col4
a    1    2    5  NaN
b  NaN    8  NaN  NaN
c  NaN  NaN  NaN    1

Is there a way to do this without iterating over all keys and values of the original_dict?

Amir
  • 29
  • 3

0 Answers0