python - Why do these two arrays have the same shape? -
so trying create array , access columns name. came this:
import numpy np data = np.ndarray(shape=(3,1000), dtype=[('x',np.float64), ('y',np.float64), ('z',np.float64)])
i confused why
data.shape
and data['x'].shape
both come (3,1000), causing me issues when i'm trying populate data fields
data['x'] = xvalues
where xvalues has shape of (1000,). there better way this?
the reason why comes out same because 'data' has bit more structure 1 revealed shape.
example:
data[0][0] returns
: (6.9182540632428e-310, 6.9182540633353e-310, 6.9182540633851e-310)
while data['x'][0][0]:
returns 6.9182540632427993e-310
so data contains 3 rows , 1000 columns, , element of 3-tuple.
data['x'] first element of tuple of combinations of 3 rows , 1000 columns, shape (3,1000) well.
Comments
Post a Comment