Skip to content

keep_nans=False ignored in nearest_neighbor mode #163

Description

@sametSeckiiin

Hi,

I noticed that SequenceInterpolator doesn't actually handle NaNs when using nearest_neighbor mode, even if keep_nans=False is set.

In interpolators.py, the linear mode has a check to fill NaNs using nanmean, but the nearest_neighbor block just returns the raw data from idx_lower:
if self.interpolation_mode == "nearest_neighbor":
data = self._data[idx_lower]
return (data, valid) if return_valid else data

because of this, interpolate() still returns NaNs when it's supposed to fill them. Is this a bug or am I missing something?

Also, idx_lower uses np.floor, so it’s always looking at the previous index instead of the actual "nearest" one. Just wanted to point that out.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions