daschw / Resample.jl

Resample Vectors and DataFrames to different resolutions
MIT License
3 stars 0 forks source link

Resampling a Vector #1

Open TheFibonacciEffect opened 1 week ago

TheFibonacciEffect commented 1 week ago

Hi, in the Readme, there are two two ways of using resample: Either using an abstract vector

resample(vec::AbstractVector, org_inds, new_inds, method = Mean())
resample(vec::AbstractVector, org_inds, step, method = Mean())

or using a table

resample(table, index_col, new_inds, methods = Mean())
resample(table, index_col, step, methods = Mean())

now I tried using it with a vector (the first method).

Like this:

using Resample
# resample(vec::AbstractVector, org_inds, step, method = Mean())
v = 1:10
resample(v::AbstractVector, 1:10, 1:2:10, methods=Sum())

however I get the assertion, that it is not a table AssertionError: Tables.istable(table).

But I dont want to use it as a table, I want to use the first method, as an abstract vector.

TheFibonacciEffect commented 1 week ago

I think using the methods keyword was the issue here. This works:

using Resample
# resample(vec::AbstractVector, org_inds, step, method = Mean())
v = 1:10
resample(v::AbstractVector, 1:10, 1:2:10, Sum())

maybe its not clear in the first lines of the readme? But it becomes more clear in the example later.