Skip to content

Refactor interpolate to work on pd.Series #867

@danielhuppmann

Description

@danielhuppmann

The interpolate() method currently works on a wide representation of the timeseries data, and then casts the result back to the long-form _data series. It would probably be more efficient to work on a group-by of the long-format series in the first place, eliminating the need to cast to wide and back.

Also, the method raises an unexpected error if not all timeseries have a datapoint before and after the year argument, i.e., the following call for df.interpolate(2007) fails...

2005 2010
model scenario region variable unit
model_a scen_a World Primary Energy EJ/yr 3.0 6.0
Primary Energy|Coal EJ/yr 0.5 NaN

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