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

Use limit_area keyword in time interpolation #3

Open
asher-pembroke opened this issue May 6, 2022 · 0 comments
Open

Use limit_area keyword in time interpolation #3

asher-pembroke opened this issue May 6, 2022 · 0 comments

Comments

@asher-pembroke
Copy link
Collaborator

You time interpolator does not limit the nans to inside the available data range. At present, values corresponding to below the available time range are assigned NaNs, but above the time range you'll get forward-filled values.

A fix is given below:

def time_interpolator(timekwarg):
    """{docstring}"""

    # Note: df will be passed into this function's local scope
    # t will be provisioned as a keyword argument

    df_ = df.reindex(df.index.union(t))
    df_interpolated = df_.interpolate(method='time', limit_area='inside')
    result = df_interpolated.reindex(t)
    return result
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

No branches or pull requests

1 participant