You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
np.rec.fromarrays(...) may fail if a field contains arrays of the same shape[0]. The error will not occur if the arrays are of different shape[0], e.g., [np.zeros(2), np.ones(3)]. The error will not occur if written as np.array([(np.zeros(2), 'a'), (np.ones(2), 'b')], dtype=[('field1', object), ('field2', '<U1')]).
Note that unlike 1.20.x the call also fails if the shapes of the arrays do not match on newer versions. So I suspect if you want the object field here, more you have to expect to do extra steps to get it.
I am unsure whether using shape and dtype or similar shouldn't work though, so I suspect there are enhancements possible, I just suspect the error in itself is OK, since the discrepancy is gone.
Describe the issue:
np.rec.fromarrays(...) may fail if a field contains arrays of the same shape[0]. The error will not occur if the arrays are of different shape[0], e.g.,
[np.zeros(2), np.ones(3)]
. The error will not occur if written asnp.array([(np.zeros(2), 'a'), (np.ones(2), 'b')], dtype=[('field1', object), ('field2', '<U1')])
.Reproduce the code example:
Error message:
NumPy/Python version information:
1.20.3 3.9.7 (default, Sep 16 2021, 08:50:36)
[Clang 10.0.0 ]
Context for the issue:
No response
The text was updated successfully, but these errors were encountered: