Click or drag to resize
SeriesExtensions Class
The type implements C# and F# extension methods for the `Series<'K, 'V>` type. The members are automatically available when you import the `Deedle` namespace. The type contains object-oriented counterparts to most of the functionality from the `Series` module. [category:Frame and series operations]
Inheritance Hierarchy
SystemObject
  DeedleSeriesExtensions

Namespace:  Deedle
Assembly:  Deedle (in Deedle.dll) Version: 1.2
Syntax
C#
[SerializableAttribute]
public class SeriesExtensions

The SeriesExtensions type exposes the following members.

Methods
  NameDescription
Public methodStatic memberContainsKeyK, T
Public methodStatic memberDiffK(SeriesK, Decimal, Int32)
Returns a series containing difference between a value in the original series and a value at the specified offset. For example, calling `Series.diff 1 s` returns a series where previous value is subtracted from the current one. ## Parameters - `offset` - When positive, subtracts the past values from the current values; when negative, subtracts the future values from the current values. - `series` - The input series.
Public methodStatic memberDiffK(SeriesK, Double, Int32)
Returns a series containing difference between a value in the original series and a value at the specified offset. For example, calling `Series.diff 1 s` returns a series where previous value is subtracted from the current one. ## Parameters - `offset` - When positive, subtracts the past values from the current values; when negative, subtracts the future values from the current values. - `series` - The input series.
Public methodStatic memberDiffK(SeriesK, Int32, Int32)
Returns a series containing difference between a value in the original series and a value at the specified offset. For example, calling `Series.diff 1 s` returns a series where previous value is subtracted from the current one. ## Parameters - `offset` - When positive, subtracts the past values from the current values; when negative, subtracts the future values from the current values. - `series` - The input series.
Public methodStatic memberDiffK(SeriesK, Single, Int32)
Returns a series containing difference between a value in the original series and a value at the specified offset. For example, calling `Series.diff 1 s` returns a series where previous value is subtracted from the current one. ## Parameters - `offset` - When positive, subtracts the past values from the current values; when negative, subtracts the future values from the current values. - `series` - The input series.
Public methodStatic memberDropMissingK, V
Drop missing values from the specified series. The returned series contains only those keys for which there is a value available in the original one. ## Parameters - `series` - An input series to be filtered ## Example let s = series [ 1 => 1.0; 2 => Double.NaN ] s.DropMissing() [fsi:val it : Series<int,float> = series [ 1 => 1] [category:Missing values]
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public methodStatic memberFillMissingK, T(SeriesK, T, Direction)
Fill missing values in the series with the nearest available value (using the specified direction). The default direction is `Direction.Backward`. Note that the series may still contain missing values after call to this function. This operation can only be used on ordered series. ## Example let sample = Series.ofValues [ Double.NaN; 1.0; Double.NaN; 3.0 ] // Returns a series consisting of [1; 1; 3; 3] sample.FillMissing(Direction.Backward) // Returns a series consisting of [<missing>; 1; 1; 3] sample.FillMissing(Direction.Forward) ## Parameters - `direction` - Specifies the direction used when searching for the nearest available value. `Backward` means that we want to look for the first value with a smaller key while `Forward` searches for the nearest greater key. [category:Missing values]
Public methodStatic memberFillMissingK, T(SeriesK, T, FuncK, T)
Fill missing values in the series using the specified function. The specified function is called with all keys for which the series does not contain value and the result of the call is used in place of the missing value. ## Parameters - `series` - An input series that is to be filled - `filler` - A function that takes key `K` and generates a value to be used in a place where the original series contains a missing value. ## Remarks This function can be used to implement more complex interpolation. For example see [handling missing values in the tutorial](../frame.html#missing) [category:Missing values]
Public methodStatic memberFillMissingK, T(SeriesK, T, T)
Fill missing values in the series with a constant value. ## Parameters - `series` - An input series that is to be filled - `value` - A constant value that is used to fill all missing values [category:Missing values]
Public methodStatic memberFillMissingK, T(SeriesK, T, K, K, Direction)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodStatic memberFirstKeyK, V
Public methodStatic memberFirstValueK, V
Public methodStatic memberFlattenK, T
Collapses a series of OptionalValue<'T> values to just 'T values
Public methodStatic memberGetAllObservationsK, T
Returns all keys from the sequence, together with the associated (optional) values. The values are returned using the `OptionalValue<T>` struct which provides `HasValue` for testing if the value is available.
Public methodStatic memberGetAllValuesK, T
Returns all (optional) values. The values are returned using the `OptionalValue<T>` struct which provides `HasValue` for testing if the value is available.
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodStatic memberGetObservationsK, T
Return observations with available values. The operation skips over all keys with missing values (such as values created from `null`, `Double.NaN`, or those that are missing due to outer join etc.).
Public methodStatic memberGetSliceK1, K2, V(SeriesTupleK1, K2, V, FSharpOptionK1, FSharpOptionK1, K2)
Public methodStatic memberGetSliceK1, K2, V(SeriesTupleK1, K2, V, K1, FSharpOptionK2, FSharpOptionK2)
Public methodStatic memberGetSliceK1, K2, V(SeriesTupleK1, K2, V, FSharpOptionK1, FSharpOptionK1, FSharpOptionK2, FSharpOptionK2)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodStatic memberChunkK, V
Public methodStatic memberChunkIntoK, V, U(SeriesK, V, Int32, FuncSeriesK, V, U)
Public methodStatic memberChunkIntoK1, V, K2, U(SeriesK1, V, Int32, FuncSeriesK1, V, KeyValuePairK2, U)
Public methodStatic memberLastKeyK, V
Public methodStatic memberLastValueK, V
Public methodStatic memberLogK
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodStatic memberOrderByKeyK, T Obsolete.
Public methodStatic memberPrintK, V
Public methodStatic memberResampleEquivalenceK, V, a(SeriesK, V, FuncK, a)
Resample the series based on equivalence class on the keys. A specified function `keyProj` is used to project keys to another space and the observations for which the projected keys are equivalent are grouped into chunks. The chunks are then returned as nested series. ## Parameters - `series` - An input series to be resampled - `keyProj` - A function that transforms keys from original space to a new space (which is then used for grouping based on equivalence) ## Remarks This operation is only supported on ordered series. The method throws `InvalidOperationException` when the series is not ordered. For unordered series, similar functionality can be implemented using `GroupBy`. [category:Lookup, resampling and scaling]
Public methodStatic memberResampleEquivalenceK, V, a, b(SeriesK, V, FuncK, a, FuncSeriesK, V, b)
Resample the series based on equivalence class on the keys. A specified function `keyProj` is used to project keys to another space and the observations for which the projected keys are equivalent are grouped into chunks. The chunks are then transformed to values using the provided function `f`. ## Parameters - `series` - An input series to be resampled - `keyProj` - A function that transforms keys from original space to a new space (which is then used for grouping based on equivalence) - `aggregate` - A function that is used to collapse a generated chunk into a single value. ## Remarks This operation is only supported on ordered series. The method throws `InvalidOperationException` when the series is not ordered. For unordered series, similar functionality can be implemented using `GroupBy`. [category:Lookup, resampling and scaling]
Public methodStatic memberResampleUniformK, V, a(SeriesK, V, FuncK, a, Funca, a)
Resample the series based on equivalence class on the keys and also generate values for all keys of the target space that are between the minimal and maximal key of the specified series (e.g. generate value for all days in the range covered by the series). For each equivalence class (e.g. date), select the latest value (with greatest key). A specified function `keyProj` is used to project keys to another space and `nextKey` is used to generate all keys in the range. When there are no values for a (generated) key, then the function attempts to get the greatest value from the previous smaller chunk (i.e. value for the previous date time). ## Parameters - `series` - An input series to be resampled - `keyProj` - A function that transforms keys from original space to a new space (which is then used for grouping based on equivalence) - `nextKey` - A function that gets the next key in the transformed space ## Remarks This operation is only supported on ordered series. The method throws `InvalidOperationException` when the series is not ordered. [category:Lookup, resampling and scaling]
Public methodStatic memberResampleUniformK1, V, K2(SeriesK1, V, FuncK1, K2, FuncK2, K2, Lookup)
Resample the series based on equivalence class on the keys and also generate values for all keys of the target space that are between the minimal and maximal key of the specified series (e.g. generate value for all days in the range covered by the series). A specified function `keyProj` is used to project keys to another space and `nextKey` is used to generate all keys in the range. The last value of each chunk is returned. When there are no values for a (generated) key, then the function attempts to get the greatest value from the previous smaller chunk (i.e. value for the previous date time). ## Parameters - `series` - An input series to be resampled - `fillMode` - When set to `Lookup.NearestSmaller` or `Lookup.NearestGreater`, the function searches for a nearest available observation in an neighboring chunk. Otherwise, the function `f` is called with an empty series as an argument. - `keyProj` - A function that transforms keys from original space to a new space (which is then used for grouping based on equivalence) - `nextKey` - A function that gets the next key in the transformed space ## Remarks This operation is only supported on ordered series. The method throws `InvalidOperationException` when the series is not ordered. [category:Lookup, resampling and scaling]
Public methodStatic memberSampleV(SeriesDateTime, V, TimeSpan)
Finds values at, or near, the specified times in a given series. The operation generates keys starting from the smallest key of the original series, using the specified `interval` and then finds nearest smaller values close to such keys. The function generates samples at, or just before the end of an interval and at, or after, the end of the series. ## Parameters - `series` - An input series to be resampled - `interval` - The interval between the individual samples ## Remarks This operation is only supported on ordered series. The method throws `InvalidOperationException` when the series is not ordered. [category:Lookup, resampling and scaling]
Public methodStatic memberSampleV(SeriesDateTimeOffset, V, TimeSpan)
Finds values at, or near, the specified times in a given series. The operation generates keys starting from the smallest key of the original series, using the specified `interval` and then finds nearest smaller values close to such keys. The function generates samples at, or just before the end of an interval and at, or after, the end of the series. ## Parameters - `series` - An input series to be resampled - `interval` - The interval between the individual samples ## Remarks This operation is only supported on ordered series. The method throws `InvalidOperationException` when the series is not ordered. [category:Lookup, resampling and scaling]
Public methodStatic memberSampleV(SeriesDateTime, V, TimeSpan, Direction)
Finds values at, or near, the specified times in a given series. The operation generates keys starting from the smallest key of the original series, using the specified `interval` and then finds nearest smaller values close to such keys according to `dir`. ## Parameters - `series` - An input series to be resampled - `interval` - The interval between the individual samples - `lookup` - Specifies how the lookup based on keys is performed. `Exact` means that the values at exact keys will be returned; `NearestGreater` returns the nearest greater key value (starting at the first key) and `NearestSmaller` returns the nearest smaller key value (starting at most `interval` after the end of the series) ## Remarks This operation is only supported on ordered series. The method throws `InvalidOperationException` when the series is not ordered. [category:Lookup, resampling and scaling]
Public methodStatic memberSampleV(SeriesDateTimeOffset, V, TimeSpan, Direction)
Finds values at, or near, the specified times in a given series. The operation generates keys starting from the smallest key of the original series, using the specified `interval` and then finds nearest smaller values close to such keys according to `dir`. ## Parameters - `series` - An input series to be resampled - `interval` - The interval between the individual samples - `dir` - Specifies how the keys should be generated. `Direction.Forward` means that the key is the smallest value of each chunk (and so first key of the series is returned and the last is not, unless it matches exactly _start + k*interval_); `Direction.Backward` means that the first key is skipped and sample is generated at, or just before the end of interval and at the end of the series. ## Remarks This operation is only supported on ordered series. The method throws `InvalidOperationException` when the series is not ordered. [category:Lookup, resampling and scaling]
Public methodStatic memberSampleV(SeriesDateTime, V, DateTime, TimeSpan, Direction)
Finds values at, or near, the specified times in a given series. The operation generates keys starting at the specified `start` time, using the specified `interval` and then finds nearest smaller values close to such keys according to `dir`. ## Parameters - `series` - An input series to be resampled - `start` - The initial time to be used for sampling - `interval` - The interval between the individual samples - `lookup` - Specifies how the lookup based on keys is performed. `Exact` means that the values at exact keys will be returned; `NearestGreater` returns the nearest greater key value (starting at the first key) and `NearestSmaller` returns the nearest smaller key value (starting at most `interval` after the end of the series) ## Remarks This operation is only supported on ordered series. The method throws `InvalidOperationException` when the series is not ordered. [category:Lookup, resampling and scaling]
Public methodStatic memberSampleV(SeriesDateTimeOffset, V, DateTimeOffset, TimeSpan, Direction)
Finds values at, or near, the specified times in a given series. The operation generates keys starting at the specified `start` time, using the specified `interval` and then finds nearest smaller values close to such keys according to `dir`. ## Parameters - `series` - An input series to be resampled - `start` - The initial time to be used for sampling - `interval` - The interval between the individual samples - `lookup` - Specifies how the lookup based on keys is performed. `Exact` means that the values at exact keys will be returned; `NearestGreater` returns the nearest greater key value (starting at the first key) and `NearestSmaller` returns the nearest smaller key value (starting at most `interval` after the end of the series) ## Remarks This operation is only supported on ordered series. The method throws `InvalidOperationException` when the series is not ordered. [category:Lookup, resampling and scaling]
Public methodStatic memberSampleK, V(SeriesK, V, IEnumerableK)
Sample an (ordered) series by finding the value at the exact or closest prior key for some new sequence of keys. ## Parameters - `series` - An input series to be sampled - `keys` - The keys at which to sample ## Remarks This operation is only supported on ordered series. The method throws `InvalidOperationException` when the series is not ordered. [category:Lookup, resampling and scaling]
Public methodStatic memberSampleIntoV(SeriesDateTime, V, TimeSpan, Direction, FuncDateTime, FSharpFuncSeriesDateTime, V, Object)
Performs sampling by time and aggregates chunks obtained by time-sampling into a single value using a specified function. The operation generates keys starting at the first key in the source series, using the specified `interval` and then obtains chunks based on these keys in a fashion similar to the `Series.resample` function. ## Parameters - `series` - An input series to be resampled - `interval` - The interval between the individual samples - `dir` - If this parameter is `Direction.Forward`, then each key is used as the smallest key in a chunk; for `Direction.Backward`, the keys are used as the greatest keys in a chunk. - `aggregate` - A function that is called to aggregate each chunk into a single value. ## Remarks This operation is only supported on ordered series. The method throws `InvalidOperationException` when the series is not ordered. [category:Lookup, resampling and scaling]
Public methodStatic memberSampleIntoV(SeriesDateTimeOffset, V, TimeSpan, Direction, FuncDateTimeOffset, FSharpFuncSeriesDateTimeOffset, V, Object)
Performs sampling by time and aggregates chunks obtained by time-sampling into a single value using a specified function. The operation generates keys starting at the first key in the source series, using the specified `interval` and then obtains chunks based on these keys in a fashion similar to the `Series.resample` function. ## Parameters - `series` - An input series to be resampled - `interval` - The interval between the individual samples - `dir` - If this parameter is `Direction.Forward`, then each key is used as the smallest key in a chunk; for `Direction.Backward`, the keys are used as the greatest keys in a chunk. - `aggregate` - A function that is called to aggregate each chunk into a single value. ## Remarks This operation is only supported on ordered series. The method throws `InvalidOperationException` when the series is not ordered. [category:Lookup, resampling and scaling]
Public methodStatic memberShiftK, V
Returns a series with values shifted by the specified offset. When the offset is positive, the values are shifted forward and first `offset` keys are dropped. When the offset is negative, the values are shifted backwards and the last `offset` keys are dropped. Expressed in pseudo-code: result[k] = series[k - offset] ## Parameters - `offset` - Can be both positive and negative number. - `series` - The input series to be shifted. ## Remarks If you want to calculate the difference, e.g. `s - (Series.shift 1 s)`, you can use `Series.diff` which will be a little bit faster.
Public methodStatic memberSortK, V
Public methodStatic memberSortByK, V, V2
Public methodStatic memberSortByKeyK, T
Returns a new series whose entries are reordered according to index order ## Parameters - `series` - An input series to be used [category:Data structure manipulation]
Public methodStatic memberSortWithK, V
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public methodStatic memberTryFirstValueK, V
Public methodStatic memberTryLastValueK, V
Public methodStatic memberWindowK, V
Public methodStatic memberWindowIntoK, V, U(SeriesK, V, Int32, FuncSeriesK, V, U)
Public methodStatic memberWindowIntoK1, V, K2, U(SeriesK1, V, Int32, FuncSeriesK1, V, KeyValuePairK2, U)
Top
See Also