gs_quant.timeseries.datetime.interpolate¶
- interpolate(x, dates=None, method=Interpolate.INTERSECT)[source]¶
Interpolate over specified dates or times
- Parameters:
x (
Series
) – timeseries to interpolatedates (
Union
[List
[date
],List
[time
],Series
,None
]) – array of dates/times or another series to interpolatemethod (
Interpolate
) – interpolation method (default: intersect)
- Return type:
Series
- Returns:
timeseries with specified dates
Usage
Interpolate the series X over the dates specified by the dates parameter. This can be an array of dates or another series, in which case the index of the series will be used to specify dates
Interpolation methods:
Type
Behavior
intersect
Resultant series only has values on the intersection of dates /times. Will only contain intersection of valid dates / times in the series
nan
Resultant series only has values on the intersection of dates /times. Value will be NaN for dates not present in the series
zero
Resultant series has values on all requested dates / times. The series will have a value of zero where the requested date or time was not present in the series
step
Resultant series has values on all requested dates / times. The series will use the value of the previous valid point if requested date does not exist. Values prior to the first date will be equivalent to the first available value
Examples
Stepwize interpolation of series based on dates in second series:
>>> a = generate_series(100) >>> b = generate_series(100) >>> interpolate(a, b, Interpolate.INTERSECT)
See also
sub()