Series ] = None, method : Interpolate = Interpolate. fillna ( method = 'bfill', inplace = True ) return else : raise MqValueError ( 'Unknown intersection type: ' + method ) fillna ( method = 'bfill', inplace = True ) new_y. fillna ( method = 'ffill', inplace = True ) new_x. fillna ( method = 'ffill', inplace = True ) new_y. interpolate ( 'time', limit_area = 'inside', inplace = True ) return if method = Interpolate. interpolate ( 'time', limit_area = 'inside', inplace = True ) new_y. align ( y, 'outer', fill_value = 0 ) if method = Interpolate. align ( y, 'outer' ) if method = Interpolate. align ( y, 'inner' ) if method = Interpolate. = **Examples** Stepwize interpolation of series based on dates in second series: > a = generate_series(100) > b = generate_series(100) > align(a, b) **See also** :func:`sub` """ if isinstance ( x, Real ) and isinstance ( y, Real ): return if isinstance ( x, Real ): return if isinstance ( y, Real ): return if method = Interpolate. Missing values surrounded by valid values will be interpolated given length of interval. Values prior to the first date will be equivalent to the first available value time Resultant series have values on the union of dates / times. Each series will use the value of the previous valid point if requested date does not exist. Values will be zero for dates or times only present in the other series step Resultant series have values on the union of dates / times. Values will be NaN for dates or times only present in the other series zero Resultant series have values on the union of dates / times. nan Resultant series have values on the union of dates /times. Interpolation methods: = Type Behavior = intersect Resultant series only have values on the intersection of dates /times. Returns two series with dates based on the method of interpolation, for example, can be used to intersect the dates of two series, union dates with a defined manner to compute missing values. Only used when both x and y are timeseries :return: timeseries with specified dates or two scalars from the input **Usage** Align the dates of two series using the specified interpolation method. Union, List ]: """ Align dates of two series or scalars :param x: first timeseries or scalar :param y: second timeseries or scalar :param method: interpolation method (default: intersect). def align ( x : Union, y : Union, method : Interpolate = Interpolate. isnan ( knot ): curve ] = current else : current = knot return curve align ( dates, 'right', ) # only need values from dates for knot in curve. index # locate previous valid date or take first value from series prev = x. empty : raise MqValueError ( 'Cannot perform step interpolation on an empty series' ) first_date = pd. Includes sampling operations based on daif dateste or time manipulation """ AggregateFunction = _create_enum ( 'AggregateFunction', ) AggregatePeriod = _create_enum ( 'AggregatePeriod', ) def _interpolate_step ( x : pd. errors import MqValueError, MqTypeError """ Date and time manipulation for timeseries, including date or time shifting, calendar operations, curve alignment and interpolation operations. datetime.date import date_range as _date_range from. datetime.date import DaćountConvention, PaymentFrequency, day_count_fraction from. from datetime import date, time, timedelta from numbers import Real import numpy as np from. Type annotations should be provided for parameters. Such functions # should be fully documented: docstrings should describe parameters and the return value, and provide a 1-line # description. # Chart Service will attempt to make public functions (not prefixed with _) from this module available. See the License for the # specific language governing permissions and limitations # under the License. # You may obtain a copy of the License at # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. # Licensed under the Apache License, Version 2.0 (the "License") # you may not use this file except in compliance with the License.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |