I have a dataframe similar to this (but much larger).
>>> df = pd.DataFrame([ [ 'a', np.array([ 1, 2]) ], [ 'b', np.array([ 3, 4 ]) ] ])
0 1
0 a [1, 2]
1 b [3, 4]
The last column has the shape listed as...
>>> df[1].shape
(2,)
I'd like it to be listed as (2,2). I was able to do this via the following line, but the performance of tolist() is... bad.
>>> np.array(df[1].tolist()).shape
(2, 2)
It could also be a Pandas dataframe as long as it correctly reports the shape. Any other suggestions?
(2,2)? Willdf[1]always be an array of 2 numbers?