Skip to content

Improving interpolate_na()'s limit argument #2392

Closed
@dnowacki-usgs

Description

@dnowacki-usgs

I've been working with some time-series data with occasional nans peppered throughout. I want to interpolate small gaps of nans (say, when there is a single isolated nan or perhaps a block of two) but leave larger blocks as nans. That is, it's not appropriate to fill large gaps, but it acceptable to do so for small gaps.

I was hoping interpolate_na() with the limit argument would do exactly this, but it turns out that if you specify, say, limit=2, it will fill the first two nans of nan-blocks of any length, no matter how long. There are definitely solutions for dealing with this, but it seems like a common issue, and has cropped up over on Pandas as well.

I'm not able to attempt tackling this right now, but I guess I wanted to put in a feature request for an additional argument to interpolate_na() that would do this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions