I need to create a DataFrame
that contains columns of DataFrames
. The DataFrames
that go in the column have different sizes and I am getting a StopIteration
exception. This doesn't happen, when the DataFrames
are of the same size. I know a Panel
is more suitable for this, but I need a DataFrame
in this case.
a=pd.DataFrame({'cat1':['one','two','three'],'cat2':['four','five','six']})
b=pd.DataFrame({'cat1':['ten','eleven'],'cat2':['twelve','thirteen']})
pd.DataFrame({'col1':{'row1':a,'row2':b}})
If I remove the 'three' and 'six' items from 'cat1', 'cat2' respectively, then this works fine. Any idea how I can achieve this?