Series
Namespace: Deedle
Attributes:
[<CompilationRepresentation(4)>]
The Series
module provides an F#-friendly API for working with data and time series.
The API follows the usual design for collection-processing in F#, so the functions work
well with the pipelining (|>
) operator. For example, given a series with ages,
we can use Series.filterValues
to filter outliers and then Stats.mean
to calculate
the mean:
1: 2: 3: |
|
The module provides comprehensive set of functions for working with series. The same API is also exposed using C#-friendly extension methods. In C#, the above snippet could be written as:
1: 2: 3: |
|
For more information about similar frame-manipulation functions, see the Frame
module.
For more information about C#-friendly extensions, see SeriesExtensions
. The functions
in the Series
module are grouped in a number of categories and documented below.
Table of contents
- Accessing series data and lookup
- Grouping, windowing and chunking
- Hierarchical index operations
- Joining, merging and zipping
- Missing values
- Processing series with exceptions
- Sampling, resampling and advanced lookup
- Series transformations
- Sorting and index manipulation
- Other module members
Accessing series data and lookup
Functions in this category provide access to the values in the series.
- The term observation is used for a key value pair in the series.
- When working with a sorted series, it is possible to perform lookup using keys that are not present in the series - you can specify to search for the previous or next available value using lookup behavior.
-
Functions such as
get
andgetAll
have their counterpartslookup
andlookupAll
that let you specify lookup behavior. -
For most of the functions that may fail, there is a
try[Foo]
variant that returnsNone
instead of failing. -
Functions with a name ending with
At
perform lookup based on the absolute integer offset (and ignore the keys of the series)
Functions and values
Grouping, windowing and chunking
This category includes functions that group data from a series in some way. Two key concepts here are window and chunk. Window refers to (overlapping) sliding windows over the input series while chunk refers to non-overlapping blocks of the series.
The boundary behavior can be specified using the Boundary
flags. The value
Skip
means that boundaries (incomplete windows or chunks) should be skipped. The value
AtBeginning
and AtEnding
can be used to define at which side should the boundary be
returned (or skipped). For chunking, AtBeginning ||| Skip
makes sense and it means that
the incomplete chunk at the beginning should be skipped (aligning the last chunk with the end).
The behavior may be specified in a number of ways (which is reflected in the name):
- dist
- using an absolute distance between the keys
- while
- using a condition on the first and last key
- size
- by specifying the absolute size of the window/chunk
The functions ending with Into
take a function to be applied to the window/chunk.
The functions window
, windowInto
and chunk
, chunkInto
are simplified versions
that take a size. There is also pairwise
function for sliding window of size two.
Functions and values
Hierarchical index operations
When the key of a series is tuple, the elements of the tuple can be treated
as multiple levels of a index. For example Series<'K1 * 'K2, 'V>
has two
levels with keys of types 'K1
and 'K2
respectively.
The functions in this cateogry provide a way for aggregating values in the
series at one of the levels. For example, given a series input
indexed by
two-element tuple, you can calculate mean for different first-level values as
follows:
1:
|
|
Note that the Stats
module provides helpers for typical statistical operations,
so the above could be written just as input |> Stats.levelMean fst
.
Functions and values
Function or value | Description |
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 Attributes: [<CompiledName("ApplyLevel")>] |
Groups the elements of the input series in groups based on the keys
produced by This operation is designed to be used with hierarchical indexing. Parameters
CompiledName: |
applyLevelOptional level op series
Signature: level:('K1 -> 'K2) -> op:(Series<'K1,'V> -> 'R option) -> series:Series<'K1,'V> -> Series<'K2,'R>
Type parameters: 'K1, 'K2, 'V, 'R Attributes: [<CompiledName("ApplyLevelOptional")>] |
Groups the elements of the input series in groups based on the keys
produced by This operation is designed to be used with hierarchical indexing. Parameters
CompiledName: |
reduceLevel level op series
Signature: level:('K1 -> 'K2) -> op:('T -> 'T -> 'T) -> series:Series<'K1,'T> -> Series<'K2,'T>
Type parameters: 'K1, 'K2, 'T Attributes: [<CompiledName("ReduceLevel")>] |
Groups the elements of the input series in groups based on the keys
produced by This operation is designed to be used with hierarchical indexing. Parameters
CompiledName: |
Joining, merging and zipping
Given two series, there are two ways to combine the values. If the keys in the series
are not overlapping (or you want to throw away values from one or the other series),
then you can use merge
or mergeUsing
. To merge more than 2 series efficiently, use
the mergeAll
function, which has been optimized for large number of series.
If you want to align two series, you can use the zipping operation. This aligns
two series based on their keys and gives you tuples of values. The default behavior
(zip
) uses outer join and exact matching. For ordered series, you can specify
other forms of key lookups (e.g. find the greatest smaller key) using zipAlign
.
functions ending with Into
are generally easier to use as they call a specified
function to turn the tuple (of possibly missing values) into a new value.
For more complicated behaviors, it is often convenient to use joins on frames instead of working with series. Create two frames with single columns and then use the join operation. The result will be a frame with two columns (which is easier to use than series of tuples).
Functions and values
Function or value | Description |
compare s1 s2
Signature: s1:Series<'K,'T> -> s2:Series<'K,'T> -> Series<'K,Diff<'T>>
Type parameters: 'K, 'T Attributes: [<CompiledName("Compare")>] |
Compares two series and returns a new series of CompiledName: |
intersect s1 s2
Signature: s1:Series<'K,'T> -> s2:Series<'K,'T> -> Series<'K,'T>
Type parameters: 'K, 'T Attributes: [<CompiledName("Intersect")>] |
Returns a new series which is intersection of two series by (key, value) pair. CompiledName: |
merge series1 series2
Signature: series1:Series<'K,'V> -> series2:Series<'K,'V> -> Series<'K,'V>
Type parameters: 'K, 'V Attributes: [<CompiledName("Merge")>] |
Merge two series with distinct keys. When the same key with a value occurs in both
series, an exception is thrown. In that case, you can use CompiledName: |
mergeAll(series)
Signature: series:seq<Series<'K,'V>> -> Series<'K,'V>
Type parameters: 'K, 'V Attributes: [<CompiledName("MergeAll")>] |
Merge multiple series with distinct keys. When the same key with a value occurs in two of the series, an exception is thrown. This function is efficient even when the number of series to be merged is large. CompiledName: |
mergeUsing behavior series1 series2
Signature: behavior:UnionBehavior -> series1:Series<'K,'V> -> series2:Series<'K,'V> -> Series<'K,'V>
Type parameters: 'K, 'V Attributes: [<CompiledName("MergeUsing")>] |
Merge two series with possibly overlapping keys. The Parameters
CompiledName: |
replace key value series
Signature: key:'K -> value:'V -> series:Series<'K,'V> -> Series<'K,'V>
Type parameters: 'K, 'V Attributes: [<CompiledName("Replace")>] |
Replace series value given in key with value. Parameters
CompiledName: |
replaceArray keys value series
Signature: keys:'K [] -> value:'V -> series:Series<'K,'V> -> Series<'K,'V>
Type parameters: 'K, 'V Attributes: [<CompiledName("replaceArray")>] |
Replace series values given in keys with value. Parameters
|
zip series1 series2
Signature: series1:Series<'K,'V1> -> series2:Series<'K,'V2> -> Series<'K,('V1 opt * 'V2 opt)>
Type parameters: 'K, 'V1, 'V2 Attributes: [<CompiledName("Zip")>] |
Align and zip two series using outer join and exact key matching. The function returns a series of tuples where both elements may be missing. As a result, it is often easier to use join on frames instead. CompiledName: |
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 Attributes: [<CompiledName("ZipAlign")>] |
Align and zip two series using the specified joining mechanism and key matching. The function returns a series of tuples where both elements may be missing. As a result, it is often easier to use join on frames instead. Parameters
CompiledName: |
zipAlignInto(...)
Signature: kind:JoinKind -> lookup:Lookup -> op:('V1 option -> 'V2 option -> 'R option) -> series1:Series<'K,'V1> -> series2:Series<'K,'V2> -> Series<'K,'R>
Type parameters: 'V1, 'V2, 'R, 'K Attributes: [<CompiledName("ZipAlignInto")>] |
Align and zip two series using the specified joining mechanism and key matching.
The function calls the specified function Parameters
CompiledName: |
zipInner series1 series2
Signature: series1:Series<'K,'V1> -> series2:Series<'K,'V2> -> Series<'K,('V1 * 'V2)>
Type parameters: 'K, 'V1, 'V2 Attributes: [<CompiledName("ZipInner")>] |
Align and zip two series using inner join and exact key matching. The function returns a series of tuples with values from the two series. CompiledName: |
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 Attributes: [<CompiledName("ZipInto")>] |
Align and zip two series using inner join and exact key matching (use Parameters
CompiledName: |
Missing values
This group of functions provides a way of working with missing values in a series.
The dropMissing
function drops all keys for which there are no values in the series.
The withMissingFrom
function lets you copy missing values from another series.
The remaining functions provide different mechanism for filling the missing values.
fillMissingWith
fills missing values with a specified constantfillMissingUsing
calls a specified function for every missing valuefillMissing
and variants propagates values from previous/later keys
Functions and values
Function or value | Description | ||
dropMissing(series)
Signature: series:Series<'K,'T> -> Series<'K,'T>
Type parameters: 'K, 'T Attributes: [<CompiledName("DropMissing")>] |
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
Example
val s : obj
val fsi : Compiler.Interactive.InteractiveSession
Multiple items
val int : value:'T -> int (requires member op_Explicit) -------------------- type int = int32 -------------------- type int<'Measure> = int Multiple items
val float : value:'T -> float (requires member op_Explicit) -------------------- type float = System.Double -------------------- type float<'Measure> = float CompiledName: |
||
fillMissing direction series
Signature: direction:Direction -> series:Series<'K,'T> -> Series<'K,'T>
Type parameters: 'K, 'T Attributes: [<CompiledName("FillMissing")>] |
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
Example
val sample : obj
CompiledName: |
||
fillMissingBetween(...)
Signature: (startKey:'K * endKey:'K) -> direction:Direction -> series:Series<'K,'T> -> Series<'K,'T>
Type parameters: 'K, 'T Attributes: [<CompiledName("FillMissingBetween")>] |
Fill missing values only between Parameters
CompiledName: |
||
fillMissingInside direction series
Signature: direction:Direction -> series:Series<'K,'T> -> Series<'K,'T>
Type parameters: 'K, 'T Attributes: [<CompiledName("FillMissingInside")>] |
Fill missing values only between the first and last non-missing values. CompiledName: |
||
fillMissingUsing f series
Signature: f:('K -> 'T) -> series:Series<'K,'T> -> Series<'K,'T>
Type parameters: 'K, 'T Attributes: [<CompiledName("FillMissingUsing")>] |
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
RemarksThis function can be used to implement more complex interpolation. For example see handling missing values in the tutorial CompiledName: |
||
fillMissingWith value series
Signature: value:'a -> series:Series<'K,'T> -> Series<'K,'T>
Type parameters: 'a, 'K, 'T Attributes: [<CompiledName("FillMissingWith")>] |
Fill missing values in the series with a constant value. Parameters
CompiledName: |
||
withMissingFrom other series
Signature: other:Series<'K,'S> -> series:Series<'K,'T> -> Series<'K,'T>
Type parameters: 'K, 'S, 'T Attributes: [<CompiledName("WithMissingFrom")>] |
Returns the current series with the same index but with values missing wherever the corresponding key exists in the other series index with an associated missing value. CompiledName: |
Processing series with exceptions
The functions in this group can be used to write computations over series that may fail.
They use the type tryval<'T>
which is defined as a discriminated union:
1: 2: 3: |
|
The function tryMap
lets you create Series<'K, tryval<'T>>
by mapping over values
of an original series. You can then extract values using tryValues
, which throws
AggregateException
if there were any errors. Functions tryErrors
and trySuccesses
give series containing only errors and successes. You can fill failed values with
a constant using fillErrorsWith
.
| Success of 'T
| Error of exn
Functions and values
Function or value | Description |
fillErrorsWith value series
Signature: value:'T -> series:Series<'K,'T tryval> -> Series<'K,'T>
Type parameters: 'T, 'K |
Givnen a series of |
tryErrors(series)
Signature: series:Series<'K,'V tryval> -> Series<'K,exn>
Type parameters: 'K, 'V |
Given a series of |
tryMap f series
Signature: f:('K -> 'T -> 'R) -> series:Series<'K,'T> -> Series<'K,'R tryval>
Type parameters: 'K, 'T, 'R |
Returns a new series by applying the specified transformation to all values
of the input series. The result contains |
trySuccesses(series)
Signature: series:Series<'K,'V tryval> -> Series<'K,'V>
Type parameters: 'K, 'V |
Given a series of |
tryValues(series)
Signature: series:Series<'K,'T tryval> -> Series<'K,'T>
Type parameters: 'K, 'T |
Obtains values from a series of |
Sampling, resampling and advanced lookup
Given a (typically) time series sampling or resampling makes it possible to get time series with representative values at lower or uniform frequency. We use the following terminology:
-
lookup
andsample
functions find values at specified key; if a key is not available, they can look for value associated with the nearest smaller or the nearest greater key. -
resample
function aggregate values values into chunks based on a specified collection of keys (e.g. explicitly provided times), or based on some relation between keys (e.g. date times having the same date). -
resampleUniform
is similar to resampling, but we specify keys by providing functions that generate a uniform sequence of keys (e.g. days), the operation also fills value for days that have no corresponding observations in the input sequence.
Functions and values
Function or value | Description |
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 Parameters
RemarksThis operation is only supported on ordered series. The method throws
|
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 Parameters
RemarksThis operation is only supported on ordered series. The method throws
|
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 Parameters
RemarksThis operation is only supported on ordered series. The method throws
|
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
Parameters
RemarksThis function is similar to This operation is only supported on ordered series. The method throws
|
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
Parameters
RemarksThis function is similar to This operation is only supported on ordered series. The method throws
|
resampleInto keys dir f series
Signature: keys:seq<'K> -> dir:Direction -> f:('K -> Series<'K,'V> -> '?690821) -> series:Series<'K,'V> -> Series<'K,'?690821>
Type parameters: 'K, 'V, '?690821 |
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 Parameters
RemarksThis operation is only supported on ordered series. The method throws
|
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 When there are no values for a (generated) key, then the function behaves according to
Parameters
RemarksThis operation is only supported on ordered series. The method throws
|
resampleUniformInto(...)
Signature: fillMode:Lookup -> keyProj:('K1 -> 'K2) -> nextKey:('K2 -> 'K2) -> f:(Series<'K1,'V> -> 'b) -> series:Series<'K1,'V> -> Series<'K2,'b>
Type parameters: 'K1, 'K2, 'V, 'b |
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 When there are no values for a (generated) key, then the function behaves according to
Parameters
RemarksThis operation is only supported on ordered series. The method throws
|
sampleTime interval dir series
Signature: interval:TimeSpan -> dir:Direction -> series:Series<^?690852,^?690853> -> Series<^?690852,Series<^?690852,^?690853>>
Type parameters: ^?690852, ^?690853 |
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 Parameters
RemarksThis operation is only supported on ordered series. The method throws
|
sampleTimeAt start interval dir series
Signature: start:^?690855 -> interval:TimeSpan -> dir:Direction -> series:Series<^?690855,^?690856> -> Series<^?690855,Series<^?690855,^?690856>>
Type parameters: ^?690855, ^?690856 |
Performs sampling by time and returns chunks obtained by time-sampling as a nested
series. The operation generates keys starting at the given Parameters
RemarksThis operation is only supported on ordered series. The method throws
|
sampleTimeAtInto(...)
Signature: start:^K -> interval:TimeSpan -> dir:Direction -> f:(Series<^K,^V> -> '?690850) -> series:Series<^K,^V> -> Series<^K,'?690850>
Type parameters: ^K, ^V, '?690850 |
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
Parameters
RemarksThis operation is only supported on ordered series. The method throws
|
sampleTimeInto interval dir f series
Signature: interval:TimeSpan -> dir:Direction -> f:(Series<^K,^V> -> '?690846) -> series:Series<^K,^V> -> Series<^K,'?690846>
Type parameters: ^K, ^V, '?690846 |
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 Parameters
RemarksThis operation is only supported on ordered series. The method throws
|
Series transformations
Functions in this category perform standard transformations on series including projections, filtering, taking some sub-series of the series, aggregating values using scanning and so on.
Projection and filtering functions generally skip over missing values, but there
are variants filterAll
and mapAll
that let you handle missing values explicitly.
Keys can be transformed using mapKeys
. When you do not need to consider the keys,
and only care about values, use filterValues
and mapValues
(which is also aliased
as the $
operator).
Series supports standard set of folding functions including reduce
and fold
(to
reduce series values into a single value) as well as the scan[All]
function, which
can be used to fold values of a series into a series of intermeidate folding results.
The functions take[Last]
and skip[Last]
can be used to take a sub-series of the
original source series by skipping a specified number of elements. Note that this
does not require an ordered series and it ignores the index - for index-based lookup
use slicing, such as series.[lo .. hi]
, instead.
Finally the shift
function can be used to obtain a series with values shifted by
the specified offset. This can be used e.g. to get previous value for each key using
Series.shift 1 ts
. The diff
function calculates difference from previous value using
ts - (Series.shift offs ts)
.
Functions and values
Function or value | Description | ||
diff offset series
Signature: offset:int -> series:Series<'K,^T> -> Series<'K,^T>
Type parameters: 'K, ^T Attributes: [<CompiledName("Diff")>] |
Returns a series containing difference between a value in the original series and
a value at the specified offset. For example, calling
Parameters
CompiledName: |
||
filter f series
Signature: f:('K -> 'T -> bool) -> series:Series<'K,'T> -> Series<'K,'T>
Type parameters: 'K, 'T Attributes: [<CompiledName("Filter")>] |
Returns a new series containing only the elements for which the specified predicate
returns CompiledName: |
||
filterAll f series
Signature: f:('K -> 'T option -> bool) -> series:Series<'K,'T> -> Series<'K,'T>
Type parameters: 'K, 'T Attributes: [<CompiledName("FilterAll")>] |
Returns a new series containing only the elements for which the specified predicate
returns CompiledName: |
||
filterValues f series
Signature: f:('T -> bool) -> series:Series<'K,'T> -> Series<'K,'T>
Type parameters: 'T, 'K Attributes: [<CompiledName("FilterValues")>] |
Returns a new series containing only the elements for which the specified predicate
returns CompiledName: |
||
flatten(series)
Signature: series:Series<'K,'T option> -> Series<'K,'T>
Type parameters: 'K, 'T Attributes: [<CompiledName("Flatten")>] |
Given a series containing optional values, flatten the option values.
That is, CompiledName: |
||
foldValues op init series
Signature: op:('?690638 -> 'T -> '?690638) -> init:'?690638 -> series:Series<'K,'T> -> '?690638
Type parameters: '?690638, 'T, 'K Attributes: [<CompiledName("FoldValues")>] |
Aggregates the values of the specified series using a function that can combine individual values. The folding starts with the specified initial value. Parameters
CompiledName: |
||
force(series)
Signature: series:Series<'K,'V> -> Series<'K,'V>
Type parameters: 'K, 'V Attributes: [<CompiledName("Force")>] |
CompiledName: |
||
map f series
Signature: f:('K -> 'T -> 'R) -> series:Series<'K,'T> -> Series<'K,'R>
Type parameters: 'K, 'T, 'R Attributes: [<CompiledName("Map")>] |
Returns a new series whose values are the results of applying the given function to values of the original series. This function skips over missing values and call the function with both keys and values. CompiledName: |
||
mapAll f series
Signature: f:('K -> 'T option -> 'R option) -> series:Series<'K,'T> -> Series<'K,'R>
Type parameters: 'K, 'T, 'R Attributes: [<CompiledName("MapAll")>] |
Returns a new series whose values are the results of applying the given function to
values of the original series. This specified function is called even when the value
is missing. It returns CompiledName: |
||
mapKeys f series
Signature: f:('K -> 'R) -> series:Series<'K,'T> -> Series<'R,'T>
Type parameters: 'K, 'R, 'T Attributes: [<CompiledName("MapKeys")>] |
Returns a new series whose keys are the results of applying the given function to keys of the original series. CompiledName: |
||
mapValues f series
Signature: f:('T -> 'R) -> series:Series<'K,'T> -> Series<'K,'R>
Type parameters: 'T, 'R, 'K Attributes: [<CompiledName("MapValues")>] |
Returns a new series whose values are the results of applying the given function to
values of the original series. This function skips over missing values and call the
function with just values. It is also aliased using the CompiledName: |
||
reduceValues op series
Signature: op:('T -> 'T -> 'T) -> series:Series<'K,'T> -> 'T
Type parameters: 'T, 'K Attributes: [<CompiledName("ReduceValues")>] |
Aggregates the values of the specified series using a function that can combine individual values. Fails if the series contains no values. Parameters
CompiledName: |
||
scanAllValues foldFunc init series
Signature: foldFunc:('R option -> 'T option -> 'R option) -> init:'R option -> series:Series<'K,'T> -> Series<'K,'R>
Type parameters: 'R, 'T, 'K Attributes: [<CompiledName("ScanAllValues")>] |
Applies a folding function starting with some initial optional value and the first optional value of the series, and continues to "scan" along the series, saving all values produced from the first function application, and yielding a new series having the original index and newly produced values. Parameters
CompiledName: |
||
scanValues foldFunc init series
Signature: foldFunc:('R -> 'T -> 'R) -> init:'R -> series:Series<'K,'T> -> Series<'K,'R>
Type parameters: 'R, 'T, 'K Attributes: [<CompiledName("ScanValues")>] |
Applies a folding function starting with some initial value and the first value of the series, and continues to "scan" along the series, saving all values produced from the first function application, and yielding a new series having the original index and newly produced values. Any application involving a missing value yields a missing value. Parameters
CompiledName: |
||
shift offset series
Signature: offset:int -> series:Series<'K,'T> -> Series<'K,'T>
Type parameters: 'K, 'T Attributes: [<CompiledName("Shift")>] |
Returns a series with values shifted by the specified offset. When the offset is
positive, the values are shifted forward and first
Parameters
RemarksIf you want to calculate the difference, e.g. CompiledName: |
||
skip count series
Signature: count:int -> series:Series<'K,'T> -> Series<'K,'T>
Type parameters: 'K, 'T Attributes: [<CompiledName("Skip")>] |
Returns a series that contains the data from the original series,
except for the first Parameters
CompiledName: |
||
skipLast count series
Signature: count:int -> series:Series<'K,'T> -> Series<'K,'T>
Type parameters: 'K, 'T Attributes: [<CompiledName("SkipLast")>] |
Returns a series that contains the data from the original series,
except for the last Parameters
CompiledName: |
||
take count series
Signature: count:int -> series:Series<'K,'T> -> Series<'K,'T>
Type parameters: 'K, 'T Attributes: [<CompiledName("Take")>] |
Returns a series that contains the specified number of keys from the original series. Parameters
CompiledName: |
||
takeLast count series
Signature: count:int -> series:Series<'K,'T> -> Series<'K,'T>
Type parameters: 'K, 'T Attributes: [<CompiledName("TakeLast")>] |
Returns a series that contains the specified number of keys from the original series. The keys are taken from the end of the series. Parameters
CompiledName: |
Sorting and index manipulation
A series that is sorted by keys allows a number of additional operations (such as lookup
using the Lookp.ExactOrSmaller
lookup behavior). However, it is also possible to sort
series based on the values - although the functions for manipulation with series do not
guarantee that the order will be preserved.
To sort series by keys, use sortByKey
. Other sorting functions let you sort the series
using a specified comparer function (sortWith
), using a projection function (sortBy
)
and using the default comparison (sort
).
In addition, you can also replace the keys of a series with other keys using indexWith
or with integers using indexOrdinally
. To pick and reorder series values using to match
a list of keys use realign
.
Functions and values
Function or value | Description |
indexOrdinally(series)
Signature: series:Series<'K,'T> -> Series<int,'T>
Type parameters: 'K, 'T Attributes: [<CompiledName("IndexOrdinally")>] |
Return a new series containing the same values as the original series, but with
ordinal index formed by CompiledName: |
indexWith keys series
Signature: keys:seq<'K2> -> series:Series<'K1,'T> -> Series<'K2,'T>
Type parameters: 'K2, 'K1, 'T Attributes: [<CompiledName("IndexWith")>] |
Returns a new series containing the specified keys mapped to the original values of the series. When the sequence contains fewer keys, the values from the series are dropped. When it contains more keys, the values for additional keys are missing. CompiledName: |
realign keys series
Signature: keys:seq<'K> -> series:Series<'K,'T> -> Series<'K,'T>
Type parameters: 'K, 'T Attributes: [<CompiledName("Realign")>] |
Given an original series and a sequence of keys, returns a new series that contains
the matching value for each of the specified keys. The CompiledName: |
rev(series)
Signature: series:Series<'K,'T> -> Series<'K,'T>
Type parameters: 'K, 'T Attributes: [<CompiledName("Reverse")>] |
Returns a new series, containing the observations of the original series in a reverse order. CompiledName: |
sort(series)
Signature: series:Series<'K,'V> -> Series<'K,'V>
Type parameters: 'K, 'V Attributes: [<CompiledName("Sort")>] |
Returns a new series, containing the observations of the original series sorted based on the default ordering defined on the values of the series. CompiledName: |
sortBy proj series
Signature: proj:('T -> 'V) -> series:Series<'K,'T> -> Series<'K,'T>
Type parameters: 'T, 'V, 'K Attributes: [<CompiledName("SortBy")>] |
Returns a new series, containing the observations of the original series sorted by values returned by the specified projection function. Parameters
CompiledName: |
sortByKey(series)
Signature: series:Series<'K,'T> -> Series<'K,'T>
Type parameters: 'K, 'T Attributes: [<CompiledName("SortByKey")>] |
Returns a new series whose observations are sorted according to keys of the index. Parameters
CompiledName: |
sortWith comparer series
Signature: comparer:('V -> 'V -> int) -> series:Series<'K,'V> -> Series<'K,'V>
Type parameters: 'V, 'K Attributes: [<CompiledName("SortWith")>] |
Returns a new series, containing the observations of the original series sorted using the specified comparison function. Parameters
CompiledName: |
Other module members
Functions and values
Function or value | Description |
convert forward backward series
Signature: forward:('T -> 'R) -> backward:('R -> 'T) -> series:Series<'K,'T> -> Series<'K,'R>
Type parameters: 'T, 'R, 'K Attributes: [<CompiledName("Convert")>] |
Retruns a new series whose values are converted using the specified conversion function.
This operation is like Parameters
RemarksThis operation is only interesting when working with virtualized data sources. Using the
CompiledName: |