I have a pandas dataframe of shape (75,9)
.
Only one of those columns is of numpy arrays, each of which is of shape (100, 4, 3)
I have a
What you're asking for is not quite possible. Pandas DataFrames are 2D. Yes, you can store NumPy arrays as object
s (references) inside DataFrame cells, but this is not really well supported, and expecting to get a shape
which has one dimension from the DataFrame and two from the arrays inside is not possible at all.
You should consider storing your data either entirely in NumPy arrays of the appropriate shape, or in a single, properly 2D DataFrame with MultiIndex. For example you can "pivot" a column of 1D arrays to become a column of scalars if you move the extra dimension to a new level of a MultIndex on the rows:
A
x [2, 3]
y [5, 6]
becomes:
A
x 0 2
1 3
y 0 5
1 6
or pivot to the columns:
A
0 1
x 2 3
y 5 6