-
Notifications
You must be signed in to change notification settings - Fork 472
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for median, average, and others #396
Comments
gerritholl
added a commit
to gerritholl/pint
that referenced
this issue
Jul 6, 2016
Make a numpy array quantity retain its unit when swapaxes is called. Previously it would turn into a regular ndarray. Add a test suite to test unit retainment for this and other ufuncs in __copy_units. I also tried to add functionality for others, such as median, average, percentile, expand_dims, atleast_1d, atleast_2d, atleast_3d, tile, rot90. However, this doesn't work because those ndarrays start with `asarray` or `asndarray`. Onother solution is needed. See also issue hgrecco#396.
I tried this in the past. The problem is that numpy calls asanyarray which does not accept anything that is not a subclass of ndarray. |
Revisit after #905 |
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I've been trying to add support for more ufuncs that keep units, by adding items to
__copy_units
. Unfortunately, many ufuncs start with callingasarray
orasanyarray
, and we probably don't want to mess with those: people callingasarray
will not expect to get aQuantity
in return. Is there another way this could be achieved?Relevant ufuncs include:
median
,average
,percentile
,expand_dims
,atleast_1d
,atleast_2d
,atleast_3d
,tile
,rot90
, and others.The text was updated successfully, but these errors were encountered: