-
craftutils.wrap.dragons.Table.Column.__array_wrap__(out_arr, context=
None) __array_wrap__ is called at the end of every ufunc.
Normally, we want a Column object back and do not have to do anything special. But there are two exceptions:
If the output shape is different (e.g. for reduction ufuncs like sum() or mean()), a Column still linking to a parent_table makes little sense, so we return the output viewed as the column content (ndarray or MaskedArray). For this case, we use “[()]” to select everything, and to ensure we convert a zero rank array to a scalar. (For some reason np.sum() returns a zero rank scalar array while np.mean() returns a scalar; So the [()] is needed for this case.
When the output is created by any function that returns a boolean we also want to consistently return an array rather than a column (see #1446 and #1685)