mcabbott / mcabbott/AxisKeys.jl
request - running lag function
Open
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 154
- Forks
- 31
- PR merge metrics
- No merged PRs in 30d
Description
Sample function shown below for 1-dimension case.
General case would be more complex.
Useful for running differences.
using AxisKeys, Dates
data = 1:10 |> collect
date = Date(2000,1,1):Date(2000,1,10) |> collect
ka = KeyedArray( data; date, )
function lagwise( ka::KeyedArray, dim::Symbol, n::Int, data_func::Function, dim_func::Function )
data = data_func.( ka.data.data[1+n:end], ka.data.data[1:end-n] )
dimV = dim_func.( axiskeys(ka,dim)[1:end-n], axiskeys(ka,dim)[1+n:end] )
KeyedArray( data, dimV )
end
lagwise( ka, :date, 2, -, tuple )
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the existing KeyedArray, axiskeys, and data access APIs used in the sample lagwise function. Determine how a lag operation should handle arbitrary dimensions and construct the resulting keys; done means a tested running-difference operation that preserves the expected data and dimension keys.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- data
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100