JuliaDB.jl
JuliaDB.jl copied to clipboard
Is there any thing like discrete difference?
trafficstars
Like what's in pandas, http://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.diff.html, or more generally http://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.shift.html
I think the answer is no. I usually do the following:
t = table((date = [Date(2007,12,31), Date(2008,12,31), Date(2009,12,31)], value = [2.1, 4.2, 8.1]))
t = @transform t {date_last_year = :date - Dates.Year(1)}
t = join(t, renamecol(t, :value, :value_last_year),
lkey = :date_last_year, rkey = :date, rselect = :value_last_year, how = :left)
t = @transform t {difference = :value - :value_last_year}
t = popcol(t, (:date_last_year, :value_last_year))
t = reindex(t, :date)
It is a bit bulky, but you have maximal control over what goes on.
But your feature request may well be warranted!