[Numpy-discussion] is __array_ufunc__ ready for prime-time?

josef.pktd at gmail.com josef.pktd at gmail.com
Thu Nov 2 08:46:01 EDT 2017


On Wed, Nov 1, 2017 at 6:55 PM, Nathan Goldbaum <nathan12343 at gmail.com>
wrote:

> I think the biggest issues could be resolved if __array_concatenate__ were
> finished. Unfortunately I don't feel like I can take that on right now.
>
> See Ryan May's talk at scipy about using an ndarray subclass for units and
> the issues he's run into:
>
> https://www.youtube.com/watch?v=qCo9bkT9sow
>


Interesting talk, but I don't see how general library code should know what
units the output has.
for example if units are some flows per unit of time and we average, sum or
integrate over time, then what are the new units? (e.g. pandas time
aggregation)
What are units of covariance or correlation between two variables with the
same units, and what are they between variables with different units?

How do you concatenate and operate arrays with different units?

interpolation or prediction would work with using the existing units.

partially related:
statsmodels uses a wrapper for pandas Series and DataFrames and tries to
preserve the index when possible and make up a new DataFrame or Series if
the existing index doesn't apply.
E.g. predicted values and residuals are in terms of the original provided
index, and could also get original units assigned. That would also be
possible with prediction confidence intervals. But for the rest, see above.

Josef


>
>
> On Wed, Nov 1, 2017 at 5:50 PM, Marten van Kerkwijk <
> m.h.vankerkwijk at gmail.com> wrote:
>
>> From my experience with Quantity, routines that properly ducktype work
>> well, those that feel the need to accept list and blatantly do
>> `asarray` do not - even if in many cases they would have worked if
>> they used `asanyarray`...  But there are lots of nice surprises, with,
>> e.g., `np.fft.fftfreq` just working as one would hope.  Anyway, bottom
>> line, I think you should let this stop you from trying only if you
>> know something important does not work. -- Marten
>> _______________________________________________
>> NumPy-Discussion mailing list
>> NumPy-Discussion at python.org
>> https://mail.python.org/mailman/listinfo/numpy-discussion
>>
>
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at python.org
> https://mail.python.org/mailman/listinfo/numpy-discussion
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20171102/0a6400e0/attachment.html>


More information about the NumPy-Discussion mailing list