Deedle


Series

Series module comment..

Table of contents

Appending, joining and zipping 

Functions and values

Function or valueDescription
append series1 series2
Signature:series1:Series<'K,'V> -> series2:Series<'K,'V> -> Series<'K,'V>
Type parameters: 'K, 'V
zip series1 series2
Signature:series1:Series<'K,'V1> -> series2:Series<'K,'V2> -> Series<'K,('V1 opt * 'V2 opt)>
Type parameters: 'K, 'V1, 'V2
zipAlign kind lookup series1 series2
Signature:kind:JoinKind -> lookup:Lookup -> series1:Series<'K,'V1> -> series2:Series<'K,'V2> -> Series<'K,('V1 opt * 'V2 opt)>
Type parameters: 'K, 'V1, 'V2
zipInner series1 series2
Signature:series1:Series<'K,'V1> -> series2:Series<'K,'V2> -> Series<'K,('V1 * 'V2)>
Type parameters: 'K, 'V1, 'V2

Data structure manipulation 

Functions and values

Function or valueDescription
orderByKey series
Signature:series:Series<'K,'T> -> Series<'K,'T>
Type parameters: 'K, 'T

Returns a new series whose entries are reordered according to index order

Parameters

  • series - An input series to be used

Joining, zipping and appending 

Functions and values

Function or valueDescription
union series1 series2
Signature:series1:Series<'K,'V> -> series2:Series<'K,'V> -> Series<'K,'V>
Type parameters: 'K, 'V
unionUsing behavior series1 series2
Signature:behavior:UnionBehavior -> series1:Series<'K,'V> -> series2:Series<'K,'V> -> Series<'K,'V>
Type parameters: 'K, 'V
zipAlignInto (...)
Signature:kind:JoinKind -> lookup:Lookup -> op:('V1 -> 'V2 -> 'R) -> series1:Series<'K,'V1> -> series2:Series<'K,'V2> -> Series<'K,'R>
Type parameters: 'V1, 'V2, 'R, 'K
zipInto op series1 series2
Signature:op:('V1 -> 'V2 -> 'R) -> series1:Series<'K,'V1> -> series2:Series<'K,'V2> -> Series<'K,'R>
Type parameters: 'V1, 'V2, 'R, 'K

Lookup, resampling and scaling 

More stuff here

Functions and values

Function or valueDescription
lookupTime interval dir lookup series
Signature:interval:TimeSpan -> dir:Direction -> lookup:Lookup -> series:Series<^K,^V> -> Series<^K,^V>
Type parameters: ^K, ^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 values close to such keys using the specified lookup and 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.
  • 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.

lookupTimeAt (...)
Signature:start:^K -> interval:TimeSpan -> dir:Direction -> lookup:Lookup -> series:Series<^K,^V> -> Series<^K,^V>
Type parameters: ^K, ^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 values close to such keys using the specified lookup and 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
  • 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.
  • 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.

resample keys dir series
Signature:keys:seq<'K> -> dir:Direction -> series:Series<'K,'V> -> Series<'K,Series<'K,'V>>
Type parameters: 'K, 'V

Resample the series based on a provided collection of keys. The values of the series are aggregated into chunks based on the specified keys. Depending on direction, the specified key is either used as the smallest or as the greatest key of the chunk (with the exception of boundaries that are added to the first/last chunk). Such chunks are then returned as nested series.

Parameters

  • series - An input series to be resampled
  • keys - A collection of keys to be used for resampling of the series
  • 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.

Remarks

This operation is only supported on ordered series. The method throws InvalidOperationException when the series is not ordered.

resampleEquiv keyProj series
Signature:keyProj:('K1 -> 'K2) -> series:Series<'K1,'V1> -> Series<'K2,Series<'K1,'V1>>
Type parameters: 'K1, 'K2, 'V1

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 function is similar to Series.chunkBy, with the exception that it transforms keys to a new space.

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 Series.groupBy.

resampleEquivInto keyProj f series
Signature:keyProj:('K1 -> 'K2) -> f:(Series<'K1,'V1> -> 'V2) -> series:Series<'K1,'V1> -> Series<'K2,'V2>
Type parameters: 'K1, 'K2, 'V1, 'V2

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)
  • f - A function that is used to collapse a generated chunk into a single value.

Remarks

This function is similar to Series.chunkBy, with the exception that it transforms keys to a new space.

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 Series.groupBy.

resampleInto keys dir f series
Signature:keys:seq<'K> -> dir:Direction -> f:('K -> Series<'K,'V> -> '?7483) -> series:Series<'K,'V> -> Series<'K,'?7483>
Type parameters: 'K, 'V, '?7483

Resample the series based on a provided collection of keys. The values of the series are aggregated into chunks based on the specified keys. Depending on direction, the specified key is either used as the smallest or as the greatest key of the chunk (with the exception of boundaries that are added to the first/last chunk). Such chunks are then aggregated using the provided function f.

Parameters

  • series - An input series to be resampled
  • keys - A collection of keys to be used for resampling of the series
  • 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.
  • f - A function that is used to collapse a generated chunk into a single value. Note that this function may be called with empty series.

Remarks

This operation is only supported on ordered series. The method throws InvalidOperationException when the series is not ordered.

resampleUniform (...)
Signature:fillMode:Lookup -> keyProj:('K1 -> 'K2) -> nextKey:('K2 -> 'K2) -> series:Series<'K1,'V> -> Series<'K2,Series<'K1,'V>>
Type parameters: 'K1, 'K2, 'V

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. Then return the chunks as nested series.

When there are no values for a (generated) key, then the function behaves according to fillMode. It can look at the greatest value of previous chunk or smallest value of the next chunk, or it produces an empty series.

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.

resampleUniformInto (...)
Signature:fillMode:Lookup -> keyProj:('K1 -> 'K2) -> nextKey:('K2 -> 'K2) -> f:(Series<'K1,'V> -> '?7500) -> series:Series<'K1,'V> -> Series<'K2,'?7500>
Type parameters: 'K1, 'K2, 'V, '?7500

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 chunk is then aggregated using f.

When there are no values for a (generated) key, then the function behaves according to fillMode. It can look at the greatest value of previous chunk or smallest value of the next chunk, or it produces an empty series.

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
  • f - A function that is used to collapse a generated chunk into a single value. The function may be called on empty series when fillMode is Lookup.Exact.

Remarks

This operation is only supported on ordered series. The method throws InvalidOperationException when the series is not ordered.

sampleTime interval dir series
Signature:interval:TimeSpan -> dir:Direction -> series:Series<^?7514,^?7515> -> Series<^?7514,Series<^?7514,^?7515>>
Type parameters: ^?7514, ^?7515

Performs sampling by time and returns chunks obtained by time-sampling as a nested
series. 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.

Remarks

This operation is only supported on ordered series. The method throws InvalidOperationException when the series is not ordered.

sampleTimeAt start interval dir series
Signature:start:^?7517 -> interval:TimeSpan -> dir:Direction -> series:Series<^?7517,^?7518> -> Series<^?7517,Series<^?7517,^?7518>>
Type parameters: ^?7517, ^?7518

Performs sampling by time and returns chunks obtained by time-sampling as a nested
series. The operation generates keys starting at the given start time, 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
  • start - The initial time to be used for sampling
  • 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.

Remarks

This operation is only supported on ordered series. The method throws InvalidOperationException when the series is not ordered.

sampleTimeAtInto (...)
Signature:start:^K -> interval:TimeSpan -> dir:Direction -> f:(Series<^K,^V> -> '?7512) -> series:Series<^K,^V> -> Series<^K,'?7512>
Type parameters: ^K, ^V, '?7512

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 given start time, 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
  • start - The initial time to be used for sampling
  • 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.
  • f - 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.

sampleTimeInto interval dir f series
Signature:interval:TimeSpan -> dir:Direction -> f:(Series<^K,^V> -> '?7508) -> series:Series<^K,^V> -> Series<^K,'?7508>
Type parameters: ^K, ^V, '?7508

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.
  • f - 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.

Missing values 

More stuff here

Functions and values

Function or valueDescription
dropMissing series
Signature:series:Series<'K,'T> -> Series<'K,'T>
Type parameters: 'K, 'T

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 |> Series.dropMissing 
[fsi:val it : Series<int,float> = series [ 1 => 1]
fillMissing direction series
Signature:direction:Direction -> series:Series<'K,'T> -> Series<'K,'T>
Type parameters: 'K, 'T

Fill missing values in the series with the nearest available value (using the specified direction). Note that the series may still contain missing values after call to this function. This operation can only be used on ordered series.

Parameters

  • series - An input series that is to be filled
  • 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.

Example

let sample = Series.ofValues [ Double.NaN; 1.0; Double.NaN; 3.0 ]

// Returns a series consisting of [1; 1; 3; 3]
sample |> Series.fillMissing Direction.Backward

// Returns a series consisting of [<missing>; 1; 1; 3]
sample |> Series.fillMissing Direction.Forward 
fillMissingBetween (...)
Signature:(startKey:'K * endKey:'K) -> direction:Direction -> series:Series<'K,'T> -> Series<'K,'T>
Type parameters: 'K, 'T
fillMissingUsing f series
Signature:f:('K -> 'T) -> series:Series<'K,'T> -> Series<'K,'T>
Type parameters: 'K, '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
  • f - 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

fillMissingWith value series
Signature:value:'?7468 -> series:Series<'K,'T> -> Series<'K,'T>
Type parameters: '?7468, 'K, '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

Statistics 

Here

Functions and values

Function or valueDescription
applyLevel level op series
Signature:level:('K1 -> 'K2) -> op:(Series<'K1,'V> -> 'R) -> series:Series<'K1,'V> -> Series<'K2,'R>
Type parameters: 'K1, 'K2, 'V, 'R

Groups the elements of the input series in groups based on the keys produced by level and then aggregates series representing each group using the specified function op. The result is a new series containing the aggregates of each group.

This operation is designed to be used with hierarchical indexing.

Parameters

  • series - An input series to be aggregated
  • op - A function that takes a series and produces an aggregated result
  • level - A delegate that returns a new group key, based on the key in the input series
countLevel level series
Signature:level:('K1 -> 'K2) -> series:Series<'K1,'V> -> Series<'K2,int>
Type parameters: 'K1, 'K2, 'V

Groups the elements of the input series in groups based on the keys produced by level and then returns a new series containing the counts of elements in each group.

This operation is designed to be used with hierarchical indexing.

Parameters

  • series - A series of values that are used to calculate the counts
  • level - A delegate that returns a new group key, based on the key in the input series
flattenLevel level op series
Signature:level:('K1 -> 'K2) -> op:(Series<'K1,'S> -> 'V) -> series:Series<'K1,'S> -> Series<'K2,'V>
Type parameters: 'K1, 'K2, 'S, 'V
max series
Signature:series:Series<'K,^V> -> ^V
Type parameters: 'K, ^V

Returns the smallest of all elements of the series. The operation skips over missing values and so the result will never be NaN.

maxLevel level series
Signature:level:('K1 -> 'K2) -> series:Series<'K1,^V> -> Series<'K2,^V>
Type parameters: 'K1, 'K2, ^V

Groups the elements of the input series in groups based on the keys produced by level and then returns a new series containing the greatest element of each group.

This operation is designed to be used with hierarchical indexing.

Parameters

  • series - A series of values that are used to calculate the greatest elements
  • level - A delegate that returns a new group key, based on the key in the input series
mean series
Signature:series:Series<'K,^V> -> ^V
Type parameters: 'K, ^V

Returns the mean of the elements of the series. The operation skips over missing values and so the result will never be NaN.

meanLevel level series
Signature:level:('K1 -> 'K2) -> series:Series<'K1,^V> -> Series<'K2,^V>
Type parameters: 'K1, 'K2, ^V

Groups the elements of the input series in groups based on the keys produced by level and then returns a new series containing the mean of each group.

This operation is designed to be used with hierarchical indexing.

Parameters

  • series - A series of values that are used to calculate the means
  • level - A delegate that returns a new group key, based on the key in the input series
median series
Signature:series:Series<'K,float> -> float
Type parameters: 'K

Returns the median of the elements of the series. The operation skips over missing values and so the result will never be NaN.

medianLevel level series
Signature:level:('?7351 -> '?7352) -> series:Series<'?7351,float> -> Series<'?7352,float>
Type parameters: '?7351, '?7352

Groups the elements of the input series in groups based on the keys produced by level and then returns a new series containing the median of each group.

This operation is designed to be used with hierarchical indexing.

Parameters

  • series - A series of values that are used to calculate the medians
  • level - A delegate that returns a new group key, based on the key in the input series
min series
Signature:series:Series<'K,^V> -> ^V
Type parameters: 'K, ^V

Returns the greatest of all elements of the series. The operation skips over missing values and so the result will never be NaN.

minLevel level series
Signature:level:('K1 -> 'K2) -> series:Series<'K1,^V> -> Series<'K2,^V>
Type parameters: 'K1, 'K2, ^V

Groups the elements of the input series in groups based on the keys produced by level and then returns a new series containing the greatest element of each group.

This operation is designed to be used with hierarchical indexing.

Parameters

  • series - A series of values that are used to calculate the greatest elements
  • level - A delegate that returns a new group key, based on the key in the input series
reduce op series
Signature:op:('T -> 'T -> 'T) -> series:Series<'K,'T> -> 'T
Type parameters: 'T, 'K

Aggregates the values of the specified series using a function that can combine individual values.

Parameters

  • series - An input series to be aggregated
  • op - A function that is used to aggregate elements of the series
reduceLevel level op series
Signature:level:('K1 -> 'K2) -> op:('T -> 'T -> 'T) -> series:Series<'K1,'T> -> Series<'K2,'T>
Type parameters: 'K1, 'K2, 'T

Groups the elements of the input series in groups based on the keys produced by level and then aggregates elements in each group using the specified function op. The result is a new series containing the aggregates of each group.

This operation is designed to be used with hierarchical indexing.

Parameters

  • series - An input series to be aggregated
  • op - A function that is used to aggregate elements of each group
  • level - A delegate that returns a new group key, based on the key in the input series
sdv series
Signature:series:Series<'K,float> -> float
Type parameters: 'K

Returns the standard deviation of the elements of the series. The operation skips over missing values and so the result will never be NaN.

sdvLevel level series
Signature:level:('K1 -> 'K2) -> series:Series<'K1,float> -> Series<'K2,float>
Type parameters: 'K1, 'K2

Groups the elements of the input series in groups based on the keys produced by level and then returns a new series containing the standard deviation of each group.

This operation is designed to be used with hierarchical indexing.

Parameters

  • series - A series of values that are used to calculate the standard deviations
  • level - A delegate that returns a new group key, based on the key in the input series
stat op series
Signature:op:(seq<'V1> -> 'V2) -> series:Series<'K,'V1> -> 'V2
Type parameters: 'V1, 'V2, 'K

Aggregates the values of the specified series using a function that operates on sequence (IEnumerable<T>). This simply reads all non-missing values and passes them to the specified operation.

Parameters

  • series - An input series to be aggregated
  • op - A function that takes a sequence and produces an aggregated result
statLevel level op series
Signature:level:('K1 -> 'K2) -> op:(seq<'V> -> 'R) -> series:Series<'K1,'V> -> Series<'K2,'R>
Type parameters: 'K1, 'K2, 'V, 'R

Groups the elements of the input series in groups based on the keys produced by level and then aggregates elements in each group using the specified function op. The result is a new series containing the aggregates of each group.

This operation is designed to be used with hierarchical indexing.

Parameters

  • series - An input series to be aggregated
  • op - A function that takes a sequence and produces an aggregated result
  • level - A delegate that returns a new group key, based on the key in the input series
sum series
Signature:series:Series<'K,^V> -> ^V
Type parameters: 'K, ^V

Returns the sum of the elements of the series. The operation skips over missing values and so the result will never be NaN.

sumLevel level series
Signature:level:('K1 -> 'K2) -> series:Series<'K1,^V> -> Series<'K2,^V>
Type parameters: 'K1, 'K2, ^V

Groups the elements of the input series in groups based on the keys produced by level and then returns a new series containing the sum of each group.

This operation is designed to be used with hierarchical indexing.

Parameters

  • series - A series of values that are used to calculate the sums
  • level - A delegate that returns a new group key, based on the key in the input series

Windowing, chunking and grouping 

The functions with name starting with windowed take a series and generate floating (overlapping) windows. The chunk functions

Functions and values

Function or valueDescription
aggregate aggregation keySelector series
Signature:aggregation:Aggregation<'K> -> keySelector:(DataSegment<Series<'K,'T>> -> 'TNewKey) -> series:Series<'K,'T> -> Series<'TNewKey,DataSegment<Series<'K,'T>>>
Type parameters: 'K, 'T, 'TNewKey

Aggregates an ordered series using the method specified by Aggregation<K> and returns the windows or chunks as nested series. A key for each window or chunk is selected using the specified keySelector.

Parameters

  • aggregation - Specifies the aggregation method using Aggregation<K>. This is a discriminated union listing various chunking and windowing conditions.
  • keySelector - A function that is called on each chunk to obtain a key.
  • series - The input series to be aggregated.
aggregateInto (...)
Signature:aggregation:Aggregation<'K> -> keySelector:(DataSegment<Series<'K,'T>> -> 'TNewKey) -> f:(DataSegment<Series<'K,'T>> -> OptionalValue<'R>) -> series:Series<'K,'T> -> Series<'TNewKey,'R>
Type parameters: 'K, 'T, 'TNewKey, 'R

Aggregates an ordered series using the method specified by Aggregation<K> and then applies the provided value selector f on each window or chunk to produce the result which is returned as a new series. A key for each window or chunk is selected using the specified keySelector.

Parameters

  • aggregation - Specifies the aggregation method using Aggregation<K>. This is a discriminated union listing various chunking and windowing conditions.
  • keySelector - A function that is called on each chunk to obtain a key.
  • f - A value selector function that is called to aggregate each chunk or window.
  • series - The input series to be aggregated.
chunk size series
Signature:size:int -> series:Series<'K,'T> -> Series<'K,Series<'K,'T>>
Type parameters: 'K, 'T

Aggregates the input into a series of adacent chunks and returns the produced chunks as a nested series. The key in the new series is the last key of the chunk. This function skips incomplete chunks - you can use Series.chunkSize for more options.

Parameters

  • size - The size of the chunk.
  • series - The input series to be aggregated.
chunkDist distance series
Signature:distance:^D -> series:Series<^K,'T> -> Series<^K,Series<^K,'T>>
Type parameters: ^D, ^K, 'T

Aggregates the input into a series of adacent chunks. A chunk is started once the distance between the first and the last key of a previous chunk is greater than the specified distance. The chunks are then returned as a nested series. The key of each chunk is the key of the first element in the chunk.

Parameters

  • distance - The maximal allowed distance between keys of a chunk. Note that this is an inline function - there must be - operator defined between distance and the keys of the series.
  • series - The input series to be aggregated.
chunkDistInto distance f series
Signature:distance:^D -> f:(Series<^K,'T> -> 'R) -> series:Series<^K,'T> -> Series<^K,'R>
Type parameters: ^D, ^K, 'T, 'R

Aggregates the input into a series of adacent chunks. A chunk is started once the distance between the first and the last key of a previous chunk is greater than the specified distance. Each chunk is then aggregated into a value using the specified function f. The key of each chunk is the key of the first element in the chunk.

Parameters

  • distance - The maximal allowed distance between keys of a chunk. Note that this is an inline function - there must be - operator defined between distance and the keys of the series.
  • f - A value selector that is called to aggregate each chunk.
  • series - The input series to be aggregated.
chunkInto size f series
Signature:size:int -> f:(Series<'K,'T> -> 'R) -> series:Series<'K,'T> -> Series<'K,'R>
Type parameters: 'K, 'T, 'R

Aggregates the input into a series of adacent chunks and then applies the provided value selector f on each chunk to produce the result which is returned as a new series. The key in the new series is the last key of the chunk. This function skips incomplete chunks - you can use Series.chunkSizeInto for more options.

Parameters

  • size - The size of the chunk.
  • series - The input series to be aggregated.
chunkSize (arg1, arg2) series
Signature:(int * Boundary) -> series:Series<'K,'T> -> Series<'K,Series<'K,'T>>
Type parameters: 'K, 'T

Aggregates the input into a series of adacent chunks using the specified size and boundary behavior and returns the produced chunks as a nested series. The key is the last key of the chunk, unless boundary behavior is Boundary.AtEnding (in which case it is the first key).

Parameters

  • bounds - Specifies the chunk size and bounary behavior. The boundary behavior can be Boundary.Skip (meaning that no incomplete chunks are produced), Boundary.AtBeginning (meaning that incomplete chunks are produced at the beginning) or Boundary.AtEnding (to produce incomplete chunks at the end of series)
  • series - The input series to be aggregated.
chunkSizeInto (arg1, arg2) f series
Signature:(int * Boundary) -> f:(DataSegment<Series<'K,'T>> -> 'R) -> series:Series<'K,'T> -> Series<'K,'R>
Type parameters: 'K, 'T, 'R

Aggregates the input into a series of adacent chunks using the specified size and boundary behavior and then applies the provided value selector f on each chunk to produce the result which is returned as a new series. The key is the last key of the chunk, unless boundary behavior is Boundary.AtEnding (in which case it is the first key).

Parameters

  • bounds - Specifies the chunk size and bounary behavior. The boundary behavior can be Boundary.Skip (meaning that no incomplete chunks are produced), Boundary.AtBeginning (meaning that incomplete chunks are produced at the beginning) or Boundary.AtEnding (to produce incomplete chunks at the end of series)
  • f - A value selector that is called to aggregate each chunk.
  • series - The input series to be aggregated.
chunkWhile cond series
Signature:cond:('K -> 'K -> bool) -> series:Series<'K,'T> -> Series<'K,Series<'K,'T>>
Type parameters: 'K, 'T

Aggregates the input into a series of adacent chunks based on a condition on keys. A chunk is started once the specified cond function returns false when called on the first and the last key of the previous chunk. The chunks are then returned as a nested series. The key of each chunk is the key of the first element in the chunk.

Parameters

  • cond - A function that is called on the first and the last key of a chunk to determine when a window should end.
  • series - The input series to be aggregated.
chunkWhileInto cond f series
Signature:cond:('K -> 'K -> bool) -> f:(Series<'K,'T> -> '?7427) -> series:Series<'K,'T> -> Series<'K,'?7427>
Type parameters: 'K, 'T, '?7427

Aggregates the input into a series of adacent chunks based on a condition on keys. A chunk is started once the specified cond function returns false when called on the first and the last key of the previous chunk. Each chunk is then aggregated into a value using the specified function f. The key of each chunk is the key of the first element in the chunk.

Parameters

  • cond - A function that is called on the first and the last key of a chunk to determine when a window should end.
  • f - A value selector that is called to aggregate each chunk.
  • series - The input series to be aggregated.
groupBy keySelector series
Signature:keySelector:('K -> 'T -> 'TNewKey) -> series:Series<'K,'T> -> Series<'TNewKey,Series<'K,'T>>
Type parameters: 'K, 'T, 'TNewKey

Groups a series (ordered or unordered) using the specified key selector (keySelector) and then returns a series of (nested) series as the result. The outer series is indexed by the newly produced keys, the nested series are indexed with the original keys.

Parameters

  • keySelector - Generates a new key that is used for aggregation, based on the original key and value. The new key must support equality testing.
  • series - An input series to be grouped.
groupInto keySelector f series
Signature:keySelector:('K -> 'T -> 'TNewKey) -> f:('TNewKey -> Series<'K,'T> -> 'TNewValue) -> series:Series<'K,'T> -> Series<'TNewKey,'TNewValue>
Type parameters: 'K, 'T, 'TNewKey, 'TNewValue

Groups a series (ordered or unordered) using the specified key selector (keySelector) and then aggregates each group into a single value, returned in the resulting series, using the provided valueSelector function.

Parameters

  • keySelector - Generates a new key that is used for aggregation, based on the original key and value. The new key must support equality testing.
  • valueSelector - A value selector function that is called to aggregate each group of collected elements.
  • series - An input series to be grouped.
pairwise series
Signature:series:Series<'K,'T> -> Series<'K,('T * 'T)>
Type parameters: 'K, 'T

Returns a series containing the predecessor and an element for each input, except for the first one. The returned series is one key shorter (it does not contain a value for the first key).

Parameters

  • series - The input series to be aggregated.

Example

let input = series [ 1 => 'a'; 2 => 'b'; 3 => 'c']
let res = input |> Series.pairwise
res = series [2 => ('a', 'b'); 3 => ('b', 'c') ]
pairwiseWith f series
Signature:f:('K -> 'T * 'T -> '?7451) -> series:Series<'K,'T> -> Series<'K,'?7451>
Type parameters: 'K, 'T, '?7451

Aggregates the input into pairs containing the predecessor and an element for each input, except for the first one. Then calls the specified aggregation function f with a tuple and a key. The returned series is one key shorter (it does not contain a value for the first key).

Parameters

  • f - A function that is called for each pair to produce result in the final series.
  • series - The input series to be aggregated.
window size series
Signature:size:int -> series:Series<'K,'T> -> Series<'K,Series<'K,'T>>
Type parameters: 'K, 'T

Creates a sliding window using the specified size and returns the produced windows as a nested series. The key in the new series is the last key of the window. This function skips incomplete chunks - you can use Series.windowSize for more options.

Parameters

  • size - The size of the sliding window.
  • series - The input series to be aggregated.
windowDist distance series
Signature:distance:^D -> series:Series<^K,'T> -> Series<^K,Series<^K,'T>>
Type parameters: ^D, ^K, 'T

Creates a sliding window based on distance between keys. A window is started at each input element and ends once the distance between the first and the last key is greater than the specified distance. The windows are then returned as a nested series. The key of each window is the key of the first element in the window.

Parameters

  • distance - The maximal allowed distance between keys of a window. Note that this is an inline function - there must be - operator defined between distance and the keys of the series.
  • series - The input series to be aggregated.
windowDistInto distance f series
Signature:distance:^?7393 -> f:(Series<^K,'T> -> '?7396) -> series:Series<^K,'T> -> Series<^K,'?7396>
Type parameters: ^?7393, ^K, 'T, '?7396

Creates a sliding window based on distance between keys. A window is started at each input element and ends once the distance between the first and the last key is greater than the specified distance. Each window is then aggregated into a value using the specified function f. The key of each window is the key of the first element in the window.

Parameters

  • distance - The maximal allowed distance between keys of a window. Note that this is an inline function - there must be - operator defined between distance and the keys of the series.
  • f - A function that is used to aggregate each window into a single value.
  • series - The input series to be aggregated.
windowInto size f series
Signature:size:int -> f:(Series<'K,'T> -> 'R) -> series:Series<'K,'T> -> Series<'K,'R>
Type parameters: 'K, 'T, 'R

Creates a sliding window using the specified size and then applies the provided value selector f on each window to produce the result which is returned as a new series. This function skips incomplete chunks - you can use Series.windowSizeInto for more options.

Parameters

  • size - The size of the sliding window.
  • series - The input series to be aggregated.
windowSize (arg1, arg2) series
Signature:(int * Boundary) -> series:Series<'K,'T> -> Series<'K,Series<'K,'T>>
Type parameters: 'K, 'T

Creates a sliding window using the specified size and boundary behavior and returns the produced windows as a nested series. The key is the last key of the window, unless boundary behavior is Boundary.AtEnding (in which case it is the first key).

Parameters

  • bounds - Specifies the window size and bounary behavior. The boundary behavior can be Boundary.Skip (meaning that no incomplete windows are produced), Boundary.AtBeginning (meaning that incomplete windows are produced at the beginning) or Boundary.AtEnding (to produce incomplete windows at the end of series)
  • series - The input series to be aggregated.
windowSizeInto (arg1, arg2) f series
Signature:(int * Boundary) -> f:(DataSegment<Series<'K,'T>> -> 'R) -> series:Series<'K,'T> -> Series<'K,'R>
Type parameters: 'K, 'T, 'R

Creates a sliding window using the specified size and boundary behavior and then applies the provided value selector f on each window to produce the result which is returned as a new series. The key is the last key of the window, unless boundary behavior is Boundary.AtEnding (in which case it is the first key).

Parameters

  • bounds - Specifies the window size and bounary behavior. The boundary behavior can be Boundary.Skip (meaning that no incomplete windows are produced), Boundary.AtBeginning (meaning that incomplete windows are produced at the beginning) or Boundary.AtEnding (to produce incomplete windows at the end of series)
  • f - A value selector that is called to aggregate each window.
  • series - The input series to be aggregated.
windowWhile cond series
Signature:cond:('K -> 'K -> bool) -> series:Series<'K,'T> -> Series<'K,Series<'K,'T>>
Type parameters: 'K, 'T

Creates a sliding window based on a condition on keys. A window is started at each input element and ends once the specified cond function returns false when called on the first and the last key of the window. The windows are then returned as a nested series. The key of each window is the key of the first element in the window.

Parameters

  • cond - A function that is called on the first and the last key of a window to determine when a window should end.
  • series - The input series to be aggregated.
windowWhileInto cond f series
Signature:cond:('K -> 'K -> bool) -> f:(Series<'K,'T> -> '?7404) -> series:Series<'K,'T> -> Series<'K,'?7404>
Type parameters: 'K, 'T, '?7404

Creates a sliding window based on a condition on keys. A window is started at each input element and ends once the specified cond function returns false when called on the first and the last key of the window. Each window is then aggregated into a value using the specified function f. The key of each window is the key of the first element in the window.

Parameters

  • cond - A function that is called on the first and the last key of a window to determine when a window should end.
  • f - A function that is used to aggregate each window into a single value.
  • series - The input series to be aggregated.

Other module members 

Functions and values

Function or valueDescription
countKeys series
Signature:series:Series<'K,'T> -> int
Type parameters: 'K, 'T

Returns the total number of keys in the specified series. This returns the total length of the series, including keys for which there is no value available.

countValues series
Signature:series:Series<'K,'T> -> int
Type parameters: 'K, 'T

Returns the total number of values in the specified series. This excludes missing values or not available values (such as values created from null, Double.NaN, or those that are missing due to outer join etc.).

diff offset series
Signature:offset:int -> series:Series<'K,^T> -> Series<'K,^?7238>
Type parameters: 'K, ^T, ^?7238

result[k] = series[k] - series[k - offset]

fillErrorsWith value series
Signature:value:'T -> series:Series<'K,'T tryval> -> Series<'K,'T>
Type parameters: 'T, 'K
filter f series
Signature:f:('K -> 'T -> bool) -> series:Series<'K,'T> -> Series<'K,'T>
Type parameters: 'K, 'T
filterAll f series
Signature:f:('K -> 'T option -> bool) -> series:Series<'K,'T> -> Series<'K,'T>
Type parameters: 'K, 'T
filterValues f series
Signature:f:('T -> bool) -> series:Series<'K,'T> -> Series<'K,'T>
Type parameters: 'T, 'K
firstKey series
Signature:series:Series<'K,'V> -> 'K
Type parameters: 'K, 'V
firstValue series
Signature:series:Series<'K,'V> -> 'V
Type parameters: 'K, 'V
force series
Signature:series:Series<'K,'V> -> Series<'K,'V>
Type parameters: 'K, 'V
get key series
Signature:key:'K -> series:Series<'K,'T> -> 'T
Type parameters: 'K, 'T

Get the value for the specified key. Uses exact lookup semantics for key lookup - use lookupAll for more options

getAll keys series
Signature:keys:seq<'K> -> series:Series<'K,'T> -> Series<'K,'T>
Type parameters: 'K, 'T

Create a new series that contains values for all provided keys. Uses exact lookup semantics for key lookup - use lookupAll for more options

getAt index series
Signature:index:int -> series:Series<'K,'T> -> 'T
Type parameters: 'K, 'T
has key series
Signature:key:'K -> series:Series<'K,'T> -> bool
Type parameters: 'K, 'T
hasAll keys series
Signature:keys:seq<'K> -> series:Series<'K,'T> -> bool
Type parameters: 'K, 'T
hasNone keys series
Signature:keys:seq<'K> -> series:Series<'K,'T> -> bool
Type parameters: 'K, 'T
hasNot key series
Signature:key:'K -> series:Series<'K,'T> -> bool
Type parameters: 'K, 'T
hasSome keys series
Signature:keys:seq<'K> -> series:Series<'K,'T> -> bool
Type parameters: 'K, 'T
indexOrdinally series
Signature:series:Series<'K,'T> -> Series<int,'T>
Type parameters: 'K, 'T
indexWith keys series
Signature:keys:seq<'K2> -> series:Series<'K1,'T> -> Series<'K2,'T>
Type parameters: 'K2, 'K1, 'T
keys series
Signature:series:Series<'K,'T> -> seq<'K>
Type parameters: 'K, 'T
lastKey series
Signature:series:Series<'K,'V> -> 'K
Type parameters: 'K, 'V
lastValue series
Signature:series:Series<'K,'V> -> 'V
Type parameters: 'K, 'V
lookup key lookup series
Signature:key:'K -> lookup:Lookup -> series:Series<'K,'T> -> 'T
Type parameters: 'K, 'T

Get the value for the specified key. Use the specified lookup semantics - for exact matching, use get

lookupAll keys lookup series
Signature:keys:seq<'K> -> lookup:Lookup -> series:Series<'K,'T> -> Series<'K,'T>
Type parameters: 'K, 'T

Create a new series that contains values for all provided keys. Use the specified lookup semantics - for exact matching, use getAll

map f series
Signature:f:('K -> 'T -> 'R) -> series:Series<'K,'T> -> Series<'K,'R>
Type parameters: 'K, 'T, 'R
mapAll f series
Signature:f:('K -> 'T option -> 'R option) -> series:Series<'K,'T> -> Series<'K,'R>
Type parameters: 'K, 'T, 'R
mapKeys f series
Signature:f:('K -> 'R) -> series:Series<'K,'T> -> Series<'R,'T>
Type parameters: 'K, 'R, 'T
mapValues f series
Signature:f:('T -> 'R) -> series:Series<'K,'T> -> Series<'K,'R>
Type parameters: 'T, 'R, 'K
maxBy f series
Signature:f:('T -> '?7286) -> series:Series<'K,'T> -> 'K * 'T
Type parameters: 'T, '?7286, 'K
minBy f series
Signature:f:('T -> '?7290) -> series:Series<'K,'T> -> 'K * 'T
Type parameters: 'T, '?7290, 'K
observations series
Signature:series:Series<'K,'T> -> seq<'K * 'T>
Type parameters: 'K, '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.).

observationsAll series
Signature:series:Series<'K,'T> -> seq<'K * 'T option>
Type parameters: 'K, 'T

Returns all keys from the sequence, together with the associated (optional) values.

realign keys series
Signature:keys:seq<'K> -> series:Series<'K,'T> -> Series<'K,'T>
Type parameters: 'K, 'T
shift offset series
Signature:offset:int -> series:Series<'K,'T> -> Series<'K,'T>
Type parameters: 'K, 'T
takeLast count series
Signature:count:int -> series:Series<'K,'T> -> Series<'K,'T>
Type parameters: 'K, 'T
tryErrors series
Signature:series:Series<'K,TryValue<'V>> -> Series<'K,exn>
Type parameters: 'K, 'V

Return a Series of all exceptions

tryGet key series
Signature:key:'K -> series:Series<'K,'T> -> 'T option
Type parameters: 'K, 'T
tryGetAt index series
Signature:index:int -> series:Series<'K,'T> -> 'T option
Type parameters: 'K, 'T
tryLookup key lookup series
Signature:key:'K -> lookup:Lookup -> series:Series<'K,'T> -> 'T option
Type parameters: 'K, 'T
tryMap f series
Signature:f:('K -> 'T -> 'R) -> series:Series<'K,'T> -> Series<'K,'R tryval>
Type parameters: 'K, 'T, 'R
trySuccesses series
Signature:series:Series<'K,TryValue<'V>> -> Series<'K,'V>
Type parameters: 'K, 'V

Return a Series of all successful tries

tryValues series
Signature:series:Series<'K,'T tryval> -> Series<'K,'T>
Type parameters: 'K, 'T

Throws AggregateException if something goes wrong

values series
Signature:series:Series<'K,'T> -> seq<'T>
Type parameters: 'K, 'T
Fork me on GitHub