[Numpy-discussion] Possible Deprecation of np.ediff1d

2018-08-27 Thread Tyler Reddy
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?

Best wishes,
Tyler
___
NumPy-Discussion mailing list
NumPy-Discussion@python.org
https://mail.python.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Possible Deprecation of np.ediff1d

2018-08-27 Thread Robert Kern
On Mon, Aug 27, 2018 at 10:30 AM Tyler Reddy 
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).

-- 
Robert Kern
___
NumPy-Discussion mailing list
NumPy-Discussion@python.org
https://mail.python.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Possible Deprecation of np.ediff1d

2018-08-27 Thread Robert Cimrman

Hi,

it was originally used in other functions of arraysetops (culprit yours truly) 
which used to use the padding functionality. Nowadays the only use I can see 
git-grepping the numpy sources is in the tests, so +1 for deprecating.


Cheers,
r.

On 08/27/2018 07:28 PM, Tyler Reddy 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?

Best wishes,
Tyler



___
NumPy-Discussion mailing list
NumPy-Discussion@python.org
https://mail.python.org/mailman/listinfo/numpy-discussion



___
NumPy-Discussion mailing list
NumPy-Discussion@python.org
https://mail.python.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Possible Deprecation of np.ediff1d

2018-08-27 Thread Charles R Harris
On Mon, Aug 27, 2018 at 11:37 AM Robert Kern  wrote:

> On Mon, Aug 27, 2018 at 10:30 AM Tyler Reddy 
> 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).
>

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

Chuck
___
NumPy-Discussion mailing list
NumPy-Discussion@python.org
https://mail.python.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Possible Deprecation of np.ediff1d

2018-08-27 Thread Eric Wieser
There is already a patch to add such a feature to np.diff at
https://github.com/numpy/numpy/pull/8206
​

On Mon, 27 Aug 2018 at 10:47 Charles R Harris 
wrote:

> On Mon, Aug 27, 2018 at 11:37 AM Robert Kern 
> wrote:
>
>> On Mon, Aug 27, 2018 at 10:30 AM Tyler Reddy 
>> 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).
>>
>
> I was thinking we might want to add something to `np.diff`, maybe using
> `np.pad`.
>
> Chuck
> ___
> NumPy-Discussion mailing list
> NumPy-Discussion@python.org
> https://mail.python.org/mailman/listinfo/numpy-discussion
>
___
NumPy-Discussion mailing list
NumPy-Discussion@python.org
https://mail.python.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Possible Deprecation of np.ediff1d

2018-08-27 Thread josef . pktd
On Mon, Aug 27, 2018 at 1:46 PM, Charles R Harris  wrote:

>
>
> On Mon, Aug 27, 2018 at 11:37 AM Robert Kern 
> wrote:
>
>> On Mon, Aug 27, 2018 at 10:30 AM Tyler Reddy 
>> 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@python.org
> https://mail.python.org/mailman/listinfo/numpy-discussion
>
>
___
NumPy-Discussion mailing list
NumPy-Discussion@python.org
https://mail.python.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Possible Deprecation of np.ediff1d

2018-08-27 Thread Stephan Hoyer
On Mon, Aug 27, 2018 at 10:30 AM Tyler Reddy 
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?
>
> Best wishes,
> Tyler
>

I don't think there's much to be gained by dropping edit1d from NumPy. It's
really not a maintenance burden to keep it around unchanged.

My preference, in keeping with our tradition of not unnecessarily causing
disruption, would be to keep this function around but mention that np.diff
should be preferred for almost all use cases in the docs. This is "Official
discouragement" strategy that came up in the recent discussion about our
deprecation policy:
https://mail.python.org/pipermail/numpy-discussion/2018-July/078474.html

I did a search in Google's codebase and turned up only a handful of uses
(~20 uses total) but in a variety of different projects:
- It appears in astropy, dask, pandas, pint, scipy and TensorFlow.
- It used in six different internal projects

Cheers,
Stephan
___
NumPy-Discussion mailing list
NumPy-Discussion@python.org
https://mail.python.org/mailman/listinfo/numpy-discussion