SeriesExtensions Type
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.
Table of contents
- Other module members
- Data structure manipulation
- Lookup, resampling and scaling
- Missing values
- Series transformations
Other module members
Static members
| Static member |
Description
|
|
|
|
|
Full Usage:
SeriesExtensions.ChunkInto(series, size, selector)
Parameters:
Series<'K1, 'V>
size : int
selector : Func<Series<'K1, 'V>, KeyValuePair<'K2, 'U>>
Returns: Series<'K2, 'U>
Type parameters: 'K1, 'V, 'K2, 'U (requires equality and equality) |
|
Full Usage:
SeriesExtensions.ChunkWhile(series, cond)
Parameters:
Series<'K, 'V>
-
The input series to be chunked.
cond : Func<'K, 'K, bool>
-
A function that is called with the first and last key of a chunk. As long as the function returns true, the chunk continues growing. When it returns false, the chunk ends and a new one is started.
Returns: Series<'K, Series<'K, 'V>>
Type parameters: 'K, 'V (requires equality) |
Splits a series into non-overlapping chunks. A new chunk is started when the condition on consecutive keys is no longer met. Returns a series of nested series, one per chunk. |
Full Usage:
SeriesExtensions.ChunkWhileInto(series, cond, reduce)
Parameters:
Series<'K, 'V>
-
The input series to be chunked.
cond : Func<'K, 'K, bool>
-
A function that is called with the first and last key of a chunk. As long as the function returns true, the chunk continues growing. When it returns false, the chunk ends and a new one is started.
reduce : Func<Series<'K, 'V>, 'U>
-
A function that aggregates each chunk series into a single value.
Returns: Series<'K, 'U>
Type parameters: 'K, 'V, 'U (requires equality) |
Splits a series into non-overlapping chunks. A new chunk is started when the condition
on consecutive keys is no longer met. Each chunk is then aggregated into a single value
using the provided
|
Full Usage:
SeriesExtensions.ContainsKey(series, key)
Parameters:
Series<'K, 'T>
key : 'K
Returns: bool
Type parameters: 'K, 'T (requires equality) |
|
Full Usage:
SeriesExtensions.Diff(series, offset)
Parameters:
Series<'K, DateTimeOffset>
offset : int
Returns: Series<'K, TimeSpan>
Type parameters: 'K (requires equality) |
Returns a series containing the difference (as
|
|
Returns a series containing the difference (as |
Full Usage:
SeriesExtensions.Diff(series, offset)
Parameters:
Series<'K, int>
-
The input series.
offset : int
-
When positive, subtracts the past values from the current values; when negative, subtracts the future values from the current values.
Returns: Series<'K, int>
Type parameters: 'K (requires equality) |
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.
|
Full Usage:
SeriesExtensions.Diff(series, offset)
Parameters:
Series<'K, decimal>
-
The input series.
offset : int
-
When positive, subtracts the past values from the current values; when negative, subtracts the future values from the current values.
Returns: Series<'K, decimal>
Type parameters: 'K (requires equality) |
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.
|
Full Usage:
SeriesExtensions.Diff(series, offset)
Parameters:
Series<'K, float32>
-
The input series.
offset : int
-
When positive, subtracts the past values from the current values; when negative, subtracts the future values from the current values.
Returns: Series<'K, float32>
Type parameters: 'K (requires equality) |
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.
|
Full Usage:
SeriesExtensions.Diff(series, offset)
Parameters:
Series<'K, float>
-
The input series.
offset : int
-
When positive, subtracts the past values from the current values; when negative, subtracts the future values from the current values.
Returns: Series<'K, float>
Type parameters: 'K (requires equality) |
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.
|
Full Usage:
SeriesExtensions.FirstKey(series)
Parameters:
Series<'K, 'V>
Returns: 'K
Type parameters: 'K, 'V (requires equality) |
|
Full Usage:
SeriesExtensions.FirstValue(series)
Parameters:
Series<'K, 'V>
Returns: 'V
Type parameters: 'K, 'V (requires equality) |
|
|
|
Full Usage:
SeriesExtensions.GetAllObservations(series)
Parameters:
Series<'K, 'T>
Returns: KeyValuePair<'K, OptionalValue<'T>> seq
Type parameters: 'K, 'T (requires equality) |
Returns all keys from the sequence, together with the associated (optional)
values. The values are returned using the `OptionalValue
|
Full Usage:
SeriesExtensions.GetAllValues(series)
Parameters:
Series<'K, 'T>
Returns: OptionalValue<'T> seq
Type parameters: 'K, 'T (requires equality) |
Returns all (optional) values. The values are returned using the
`OptionalValue
|
Full Usage:
SeriesExtensions.GetObservations(series)
Parameters:
Series<'K, 'T>
Returns: KeyValuePair<'K, 'T> seq
Type parameters: 'K, 'T (requires equality) |
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.).
|
|
|
|
|
|
|
Full Usage:
SeriesExtensions.LastKey(series)
Parameters:
Series<'K, 'V>
Returns: 'K
Type parameters: 'K, 'V (requires equality) |
|
Full Usage:
SeriesExtensions.LastValue(series)
Parameters:
Series<'K, 'V>
Returns: 'V
Type parameters: 'K, 'V (requires equality) |
|
|
|
|
|
Full Usage:
SeriesExtensions.PairwiseWith(series, f)
Parameters:
Series<'K, 'T>
-
The input series.
f : Func<'K, 'T, 'T, 'U>
-
A function that is called for each pair of consecutive values to produce the result value. The arguments are the key, the previous value, and the current value.
Returns: Series<'K, 'U>
Type parameters: 'K, 'T, 'U (requires equality) |
Returns a series containing the result of applying the specified function to each pair of consecutive values in the series. The function receives the key and both the preceding and the current value.
|
Full Usage:
SeriesExtensions.PctChange(series, offset)
Parameters:
Series<'K, decimal>
-
The input series.
offset : int
-
When positive, computes change from past values; when negative, computes change relative to future values.
Returns: Series<'K, decimal>
Type parameters: 'K (requires equality) |
Returns a series containing the percentage change between a value in the original series and
a value at the specified offset. For example, calling
|
Full Usage:
SeriesExtensions.PctChange(series, offset)
Parameters:
Series<'K, float32>
-
The input series.
offset : int
-
When positive, computes change from past values; when negative, computes change relative to future values.
Returns: Series<'K, float32>
Type parameters: 'K (requires equality) |
Returns a series containing the percentage change between a value in the original series and
a value at the specified offset. For example, calling
|
Full Usage:
SeriesExtensions.PctChange(series, offset)
Parameters:
Series<'K, float>
-
The input series.
offset : int
-
When positive, computes change from past values; when negative, computes change relative to future values.
Returns: Series<'K, float>
Type parameters: 'K (requires equality) |
Returns a series containing the percentage change between a value in the original series and
a value at the specified offset. For example, calling
|
Full Usage:
SeriesExtensions.Print(series)
Parameters:
Series<'K, 'V>
Type parameters: 'K, 'V (requires equality) |
|
|
|
|
|
|
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] 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.
|
|
|
|
|
|
|
Full Usage:
SeriesExtensions.TryFirstValue(series)
Parameters:
Series<'K, 'V>
Returns: 'V option
Type parameters: 'K, 'V (requires equality) |
|
Full Usage:
SeriesExtensions.TryLastValue(series)
Parameters:
Series<'K, 'V>
Returns: 'V option
Type parameters: 'K, 'V (requires equality) |
|
|
|
|
|
Full Usage:
SeriesExtensions.WindowInto(series, size, selector)
Parameters:
Series<'K1, 'V>
size : int
selector : Func<Series<'K1, 'V>, KeyValuePair<'K2, 'U>>
Returns: Series<'K2, 'U>
Type parameters: 'K1, 'V, 'K2, 'U (requires equality and equality) |
|
Full Usage:
SeriesExtensions.WindowWhile(series, cond)
Parameters:
Series<'K, 'V>
-
The input series to be windowed.
cond : Func<'K, 'K, bool>
-
A function that is called with the first and last key of a window. As long as the function returns true, the window continues growing. When it returns false, the window ends and a new one is started.
Returns: Series<'K, Series<'K, 'V>>
Type parameters: 'K, 'V (requires equality) |
Creates a series of sliding windows. The windows are created based on the specified condition: a new window is started when the condition on consecutive keys is no longer met. Returns a series of nested series, one per window. |
Full Usage:
SeriesExtensions.WindowWhileInto(series, cond, reduce)
Parameters:
Series<'K, 'V>
-
The input series to be windowed.
cond : Func<'K, 'K, bool>
-
A function that is called with the first and last key of a window. As long as the function returns true, the window continues growing. When it returns false, the window ends and a new one is started.
reduce : Func<Series<'K, 'V>, 'U>
-
A function that aggregates each window series into a single value.
Returns: Series<'K, 'U>
Type parameters: 'K, 'V, 'U (requires equality) |
Creates a series of sliding windows. The windows are created based on the specified
condition: a new window is started when the condition on consecutive keys is no longer met.
Each window is then aggregated into a single value using the provided
|
Full Usage:
SeriesExtensions.ZipAlignInto(series1, series2, op, kind, lookup)
Parameters:
Series<'K, 'V1>
-
The first series to align and combine.
series2 : Series<'K, 'V2>
-
The second series to align and combine.
op : Func<OptionalValue<'V1>, OptionalValue<'V2>, OptionalValue<'R>>
-
A function receiving optional values for each key; return an empty OptionalValue to produce a missing value.
kind : JoinKind
-
Specifies the join kind (inner, outer, left, right).
lookup : Lookup
-
Specifies how keys are looked up in ordered series.
Returns: Series<'K, 'R>
Type parameters: 'K, 'V1, 'V2, 'R (requires equality) |
Align two series using the specified join kind and key lookup, and combine
matching values using the provided function. When either value is missing
(outer-join key present in only one series), the corresponding
OptionalValue{T} will have
|
|
Align two series using inner join and exact key matching. The result is a series of tuples containing the values from both series for each shared key. Keys that are present in only one of the series are dropped.
|
Full Usage:
SeriesExtensions.ZipInto(series1, series2, op)
Parameters:
Series<'K, 'V1>
-
The first series to combine.
series2 : Series<'K, 'V2>
-
The second series to combine with.
op : Func<'V1, 'V2, 'R>
-
A function that combines corresponding values.
Returns: Series<'K, 'R>
Type parameters: 'K, 'V1, 'V2, 'R (requires equality) |
Align two series using inner join and exact key matching, and combine matching values using the provided function. Keys that are present in only one of the series are dropped (inner-join semantics). This is a convenience alternative to the arithmetic operators for series with custom element types that have their own operators defined.
|
Data structure manipulation
Static members
| Static member |
Description
|
|
Lookup, resampling and scaling
Static members
| Static member |
Description
|
Full Usage:
SeriesExtensions.ResampleEquivalence(series, keyProj, aggregate)
Parameters:
Series<'K, 'V>
-
An input series to be resampled
keyProj : Func<'K, 'a>
-
A function that transforms keys from original space to a new space (which is then used for grouping based on equivalence)
aggregate : Func<Series<'K, 'V>, 'b>
-
A function that is used to collapse a generated chunk into a single value.
Returns: Series<'a, 'b>
Type parameters: 'K, 'V, 'a, 'b (requires equality and equality) |
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`. 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`.
|
Full Usage:
SeriesExtensions.ResampleEquivalence(series, keyProj)
Parameters:
Series<'K, 'V>
-
An input series to be resampled
keyProj : Func<'K, 'a>
-
A function that transforms keys from original space to a new space (which is then used for grouping based on equivalence)
Returns: Series<'a, Series<'K, 'V>>
Type parameters: 'K, 'V, 'a (requires equality and equality) |
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. 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`. |
Full Usage:
SeriesExtensions.ResampleUniform(series, keyProj, nextKey, fillMode)
Parameters:
Series<'K1, 'V>
-
An input series to be resampled
keyProj : Func<'K1, 'K2>
-
A function that transforms keys from original space to a new space (which is then used for grouping based on equivalence)
nextKey : Func<'K2, 'K2>
-
A function that gets the next key in the transformed space
fillMode : Lookup
-
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.
Returns: Series<'K2, 'V>
Type parameters: 'K1, 'V, 'K2 (requires equality and comparison) |
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). This operation is only supported on ordered series. The method throws `InvalidOperationException` when the series is not ordered.
|
Full Usage:
SeriesExtensions.ResampleUniform(series, keyProj, nextKey)
Parameters:
Series<'K, 'V>
-
An input series to be resampled
keyProj : Func<'K, 'a>
-
A function that transforms keys from original space to a new space (which is then used for grouping based on equivalence)
nextKey : Func<'a, 'a>
-
A function that gets the next key in the transformed space
Returns: Series<'a, 'V>
Type parameters: 'K, 'V, 'a (requires equality and comparison) |
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). This operation is only supported on ordered series. The method throws `InvalidOperationException` when the series is not ordered.
|
Full Usage:
SeriesExtensions.Sample(series, interval)
Parameters:
Series<DateTimeOffset, 'V>
-
An input series to be resampled
interval : TimeSpan
-
The interval between the individual samples
Returns: Series<DateTimeOffset, 'V>
Type parameters: 'V |
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. This operation is only supported on ordered series. The method throws `InvalidOperationException` when the series is not ordered.
|
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. This operation is only supported on ordered series. The method throws `InvalidOperationException` when the series is not ordered. |
|
Full Usage:
SeriesExtensions.Sample(series, interval, dir)
Parameters:
Series<DateTimeOffset, 'V>
-
An input series to be resampled
interval : TimeSpan
-
The interval between the individual samples
dir : Direction
-
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.
Returns: Series<DateTimeOffset, 'V>
Type parameters: 'V |
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`. This operation is only supported on ordered series. The method throws `InvalidOperationException` when the series is not ordered.
|
Full Usage:
SeriesExtensions.Sample(series, interval, dir)
Parameters:
Series<DateTime, 'V>
-
An input series to be resampled
interval : TimeSpan
-
The interval between the individual samples
dir : Direction
-
Specifies the direction. `Backward` means that we want to look for the first value with a smaller key while `Forward` searches for the nearest greater key.
Returns: Series<DateTime, 'V>
Type parameters: 'V |
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`. This operation is only supported on ordered series. The method throws `InvalidOperationException` when the series is not ordered. |
Full Usage:
SeriesExtensions.Sample(series, start, interval, dir)
Parameters:
Series<DateTimeOffset, 'V>
-
An input series to be resampled
start : DateTimeOffset
-
The initial time to be used for sampling
interval : TimeSpan
-
The interval between the individual samples
dir : Direction
-
Specifies the direction. `Backward` means that we want to look for the first value with a smaller key while `Forward` searches for the nearest greater key.
Returns: Series<DateTimeOffset, 'V>
Type parameters: 'V |
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`. This operation is only supported on ordered series. The method throws `InvalidOperationException` when the series is not ordered.
|
Full Usage:
SeriesExtensions.Sample(series, start, interval, dir)
Parameters:
Series<DateTime, 'V>
-
An input series to be resampled
start : DateTime
-
The initial time to be used for sampling
interval : TimeSpan
-
The interval between the individual samples
dir : Direction
-
Specifies the direction. `Backward` means that we want to look for the first value with a smaller key while `Forward` searches for the nearest greater key.
Returns: Series<DateTime, 'V>
Type parameters: 'V |
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`. This operation is only supported on ordered series. The method throws `InvalidOperationException` when the series is not ordered.
|
|
Sample an (ordered) series by finding the value at the exact or closest prior key for some new sequence of keys. This operation is only supported on ordered series. The method throws `InvalidOperationException` when the series is not ordered.
|
Full Usage:
SeriesExtensions.SampleInto(series, interval, dir, aggregate)
Parameters:
Series<DateTimeOffset, 'V>
-
An input series to be resampled
interval : TimeSpan
-
The interval between the individual samples
dir : Direction
-
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 : Func<DateTimeOffset, (Series<DateTimeOffset, 'V> -> obj)>
-
A function that is called to aggregate each chunk into a single value.
Returns: Series<DateTimeOffset, obj>
Type parameters: 'V |
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. This operation is only supported on ordered series. The method throws `InvalidOperationException` when the series is not ordered.
|
Full Usage:
SeriesExtensions.SampleInto(series, interval, dir, aggregate)
Parameters:
Series<DateTime, 'V>
-
An input series to be resampled
interval : TimeSpan
-
The interval between the individual samples
dir : Direction
-
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 : Func<DateTime, (Series<DateTime, 'V> -> obj)>
-
A function that is called to aggregate each chunk into a single value.
Returns: Series<DateTime, obj>
Type parameters: 'V |
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. This operation is only supported on ordered series. The method throws `InvalidOperationException` when the series is not ordered.
|
Missing values
Static members
| Static member |
Description
|
|
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.
Example
val s: obj
|
Full Usage:
SeriesExtensions.FillMissing(series, filler)
Parameters:
Series<'K, 'T>
-
An input series that is to be filled
filler : Func<'K, 'T>
-
A function that takes key `K` and generates a value to be used in a place where the original series contains a missing value.
Returns: Series<'K, 'T>
Type parameters: 'K, 'T (requires equality) |
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. This function can be used to implement more complex interpolation. For example see [handling missing values in the tutorial](../frame.html#missing)
|
Full Usage:
SeriesExtensions.FillMissing(series, ?direction)
Parameters:
Series<'K, 'T>
-
The input series to be filled
?direction : 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.
Returns: Series<'K, 'T>
Type parameters: 'K, 'T (requires equality) |
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
val sample: obj
|
|
Series transformations
Static members
| Static member |
Description
|
|
Deedle