Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interpolation between two identical values #18

Closed
ErwanPiR opened this issue Jun 24, 2019 · 1 comment · Fixed by #19
Closed

Interpolation between two identical values #18

ErwanPiR opened this issue Jun 24, 2019 · 1 comment · Fixed by #19

Comments

@ErwanPiR
Copy link

Hi,

It seems that the implementation cannot deal with interpolation between two identical values...

For example, let's say you have an array like this :
x = [1, 1, 1, 2, 2, 2, 3, missing, 3, 4, 4, 4]
Obviously the result of the interpolation to replace the missing value should be 3 !

But using impute with :interp result in an error
impute(x, :interp)
ERROR: ArgumentError: range step cannot be zero

In fact in interp.jl, line 33 you do
values = Real(start_val):Real(incr):Real(stop_val)
with cause the error due to identical values on the left and right side of the missing in the array.

Can you add an exception in this case ?

Thanks.

@rofinn
Copy link
Member

rofinn commented Jun 28, 2019

Should be fixed on master. Thanks for raising the issue 👍

julia> using Impute

julia> x = [1, 1, 1, 2, 2, 2, 3, missing, 3, 4, 4, 4]
12-element Array{Union{Missing, Int64},1}:
 1
 1
 1
 2
 2
 2
 3
  missing
 3
 4
 4
 4

julia> impute(x, :interp)
12-element Array{Union{Missing, Int64},1}:
 1
 1
 1
 2
 2
 2
 3
 3
 3
 4
 4
 4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants