[Numpy-discussion] Possible Deprecation of np.ediff1d

josef.pktd at gmail.com josef.pktd at gmail.com
Mon Aug 27 15:28:15 EDT 2018


On Mon, Aug 27, 2018 at 1:46 PM, Charles R Harris <charlesr.harris at gmail.com
> wrote:

>
>
> On Mon, Aug 27, 2018 at 11:37 AM Robert Kern <robert.kern at gmail.com>
> wrote:
>
>> On Mon, Aug 27, 2018 at 10:30 AM Tyler Reddy <tyler.je.reddy at gmail.com>
>> wrote:
>>
>>> Chuck suggested ( https://github.com/numpy/
>>> numpy/pull/11805#issuecomment-416069436 ) that we may want to consider
>>> deprecating np.ediff1d, which is perhaps not much more useful than np.diff,
>>> apart from having some arguably strange prepend / append behavior added in.
>>>
>>> Related discussion on SO: https://stackoverflow.com/
>>> questions/39014324/difference-between-numpy-ediff1d-and-diff
>>>
>>> Thoughts?
>>>
>>
>> Huh. Never knew this existed. I'd say about 50% of the time I use
>> np.diff(), I'm doing that prepend/append behavior manually (and less
>> readably, possibly inefficiently, but most importantly annoyingly).
>>
>
same for me
never seen, never used



>
> I was thinking we might want to add something to `np.diff`, maybe using
> `np.pad`.
>

ediff1d avoids one extra temp array compared to simple padding.

However, ediff1d pads the final, difference array instead of the original
data array.

AFAIR, I almost always need padding of the original array.

eg as in the standard example of round tripping between cumsum and diff

Josef



>
> Chuck
>
> _______________________________________________
> 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/20180827/b38f81a8/attachment.html>


More information about the NumPy-Discussion mailing list