You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
x =KeyedArray(rand(10, 20), x=1:10, y=1:20)
diff(x; dims=:x)
Currently, diff(x; dims=1) errors because diff changes the size of the array. There is some ambiguity about the correct way to handle keys in the result. In some strict sense, the keys should be something like "Δ(1, 2)". But I think the most natural/useful thing would probably be to just use the lower label (so, drop 10).
The text was updated successfully, but these errors were encountered:
function Base.diff(K::KeyedArray; dims, removefirst::Bool=true)
range = removefirst ? (2:size(K, dims)) : (1:size(K,dims)-1)
out = similar(selectdim(K, dims, range) )
out[:] = Base.diff(parent(parent(K)); dims=NamedDims.dim(parent(K),dims))
return out
end
e.g.
Currently,
diff(x; dims=1)
errors because diff changes the size of the array. There is some ambiguity about the correct way to handle keys in the result. In some strict sense, the keys should be something like "Δ(1, 2)". But I think the most natural/useful thing would probably be to just use the lower label (so, drop 10).The text was updated successfully, but these errors were encountered: