I have a frozen set whose elements are like this:
{frozenset({'e', 'f'}), frozenset({'a', 'b'}), frozenset({'c', 'd'}),....}
I want to write the elements in the frozen set to a pandas dataframe like this:
col1 col2
0 a b
1 c d
2 e f
.. .. ..
What is the most efficient way to do this?
You can convert your set to a list then create the dataframe. Let's call your set dat
in the example below:
df = pd.DataFrame(list(dat), columns=['col1', 'col2'])
Yields a separate row in the DataFrame for each set in dat
.