DataFrames.jl icon indicating copy to clipboard operation
DataFrames.jl copied to clipboard

feature request: `shift`

Open adienes opened this issue 2 years ago • 2 comments

I know there is ShiftedArrays.jl , but (and not to sound needy) I think that adding a new package dependency, typing out the 12-character ShiftedArray instead of just shift, and then having to deal with a new wrapper type e.g. ShiftedVector{Float64, Missing, Vector{Float64}} instead of Vector{Union{Missing, Float64}} is too much overhead for a pretty fundamental shift operation

adienes avatar Oct 16 '23 02:10 adienes

I just realized there is the lag function. this mitigates the issue of the number of characters somewhat, but the other two annoyances stand

maybe DataFrames can "re"-export this function? I put "re" in scare quotes as it seems ShiftedArrays itself does not export this

adienes avatar Oct 16 '23 02:10 adienes

@nalimilan - what do you think?

We have been trying to avoid adding such functionalities to DataFrames.jl in the past, but indeed for newcomers discovering that you need to write:

import ShiftedArrays: lag

and then that they get a view, not a copy, is hard to grasp (I know this from my teaching experience).

bkamins avatar Oct 16 '23 06:10 bkamins