I have a pandas dataframe of singleton Python matrices that I want to convert to dataframe of values. I can use apply to convert individual columns, but was wondering if I could do this over the entire dataframe. Here is what I have so far:
Dataframe df:
+-----------+-----------+-----------+-----------+-----------+-----------+
| Col1 | Col2 | Col3 | Col4 | Col5 | Col6 |
+-----------+-----------+-----------+-----------+-----------+-----------+
| [[[[4]]]] | [[[[0]]]] | [[[[1]]]] | [[[[0]]]] | [[[[0]]]] | [[[[1]]]] |
| [[[[1]]]] | [[[[1]]]] | [[[[0]]]] | [[[[2]]]] | [[[[1]]]] | [[[[1]]]] |
| [[[[0]]]] | [[[[2]]]] | [[[[3]]]] | [[[[1]]]] | [[[[1]]]] | [[[[0]]]] |
+-----------+-----------+-----------+-----------+-----------+-----------+
code to convert an individual column:
df.Col1.apply(lambda x: np.asarray(x).ravel()[0])