Header menu logo Deedle

Frame Module

The `Frame` module provides an F#-friendly API for working with data frames. The module follows the usual desing for collection-processing in F#, so the functions work well with the pipelining operator (`|>`). For example, given a frame with two columns representing prices, we can use `Frame.pctChange` to calculate daily returns like this: let df = frame [ "MSFT" => prices1; "AAPL" => prices2 ] let rets = df |> Frame.pctChange 1 rets |> Stats.mean Note that the `Stats.mean` operation is overloaded and works both on series (returning a number) and on frames (returning a series). You can also use `Frame.diff` if you need absolute differences rather than relative changes. The functions in this module are designed to be used from F#. For a C#-friendly API, see the `FrameExtensions` type. For working with individual series, see the `Series` module. The functions in the `Frame` module are grouped in a number of categories and documented below. Accessing frame data and lookup ------------------------------- Functions in this category provide access to the values in the fame. You can also add and remove columns from a frame (which both return a new value). - `addCol`, `replaceCol` and `dropCol` can be used to create a new data frame with a new column, by replacing an existing column with a new one, or by dropping an existing column - `cols` and `rows` return the columns or rows of a frame as a series containing objects; `getCols` and `getRows` return a generic series and cast the values to the type inferred from the context (columns or rows of incompatible types are skipped); `getNumericCols` returns columns of a type convertible to `float` for convenience. - You can get a specific row or column using `get[Col|Row]` or `lookup[Col|Row]` functions. The `lookup` variant lets you specify lookup behavior for key matching (e.g. find the nearest smaller key than the specified value). There are also `[try]get` and `[try]Lookup` functions that return optional values and functions returning entire observations (key together with the series). - `sliceCols` and `sliceRows` return a sub-frame containing only the specified columns or rows. Finally, `toArray2D` returns the frame data as a 2D array. Grouping, windowing and chunking -------------------------------- The basic grouping functions in this category can be used to group the rows of a data frame by a specified projection or column to create a frame with hierarchical index such as Frame<'K1 * 'K2, 'C>. The functions always aggregate rows, so if you want to group columns, you need to use `Frame.transpose` first. The function `groupRowsBy` groups rows by the value of a specified column. Use `groupRowsBy[Int|Float|String...]` if you want to specify the type of the column in an easier way than using type inference; `groupRowsUsing` groups rows using the specified _projection function_ and `groupRowsByIndex` projects the grouping key just from the row index. More advanced functions include: `aggregateRowsBy` which groups the rows by a specified sequence of columns and aggregates each group into a single value; `pivotTable` implements the pivoting operation [as documented in the tutorials](../frame.html#pivot). The `melt` and `unmelt` functions turn the data frame into a single data frame containing columns `Row`, `Column` and `Value` containing the data of the original frame; `unmelt` can be used to turn this representation back into an original frame. The `stack` and `unstack` functions implement pandas-style reshape operations. `stack` converts `Frame<'R,'C>` to a long-format `Frame<'R*'C, string>` where each cell becomes a row keyed by `(rowKey, colKey)` with a single `"Value"` column. `unstack` promotes the inner row-key level to column keys, producing `Frame<'R1, 'C*'R2>` from `Frame<'R1*'R2,'C>`. A simple windowing functions that are exposed for an entire frame operations are `window` and `windowInto`. For more complex windowing operations, you currently have to use `mapRows` or `mapCols` and apply windowing on individual series. Sorting and index manipulation ------------------------------ A frame is indexed by row keys and column keys. Both of these indices can be sorted (by the keys). A frame that is sorted allows a number of additional operations (such as lookup using the `Lookp.ExactOrSmaller` lookup behavior). The functions in this category provide ways for manipulating the indices. It is expected that most operations are done on rows and so more functions are available in a row-wise way. A frame can alwyas be transposed using `Frame.transpose`. Index operations: The existing row/column keys can be replaced by a sequence of new keys using the `indexColsWith` and `indexRowsWith` functions. Row keys can also be replaced by ordinal numbers using `indexRowsOrdinally`. The function `indexRows` uses the specified column of the original frame as the index. It removes the column from the resulting frame (to avoid this, use overloaded `IndexRows` method). This function infers the type of row keys from the context, so it is usually more convenient to use `indexRows[Date|String|Int|...]` functions. Finally, if you want to calculate the index value based on multiple columns of the row, you can use `indexRowsUsing`. Sorting frame rows: Frame rows can be sorted according to the value of a specified column using the `sortRows` function; `sortRowsBy` takes a projection function which lets you transform the value of a column (e.g. to project a part of the value). The functions `sortRowsByKey` and `sortColsByKey` sort the rows or columns using the default ordering on the key values. The result is a frame with ordered index. Expanding columns: When the frame contains a series with complex .NET objects such as F# records or C# classes, it can be useful to "expand" the column. This operation looks at the type of the objects, gets all properties of the objects (recursively) and generates multiple series representing the properties as columns. The function `expandCols` expands the specified columns while `expandAllCols` applies the expansion to all columns of the data frame. Frame transformations --------------------- Functions in this category perform standard transformations on data frames including projections, filtering, taking some sub-frame of the frame, aggregating values using scanning and so on. Projection and filtering functions such as `[map|filter][Cols|Rows]` call the specified function with the column or row key and an ObjectSeries<'K> representing the column or row. You can use functions ending with `Values` (such as `mapRowValues`) when you do not require the row key, but only the row series; `mapRowKeys` and `mapColKeys` can be used to transform the keys. You can use `reduceValues` to apply a custom reduction to values of columns. Other aggregations are available in the `Stats` module. You can also get a row with the greaterst or smallest value of a given column using `[min|max]RowBy`. The functions `take[Last]` and `skip[Last]` can be used to take a sub-frame of the original source frame by skipping a specified number of rows. Note that this does not require an ordered frame and it ignores the index - for index-based lookup use slicing, such as `df.Rows.[lo .. hi]`, instead. Finally the `shift` function can be used to obtain a frame with values shifted by the specified offset. This can be used e.g. to get previous value for each key using `Frame.shift 1 df`. The `diff` function calculates difference from previous value using `df - (Frame.shift offs df)`. Processing frames with exceptions --------------------------------- The functions in this group can be used to write computations over frames that may fail. They use the type tryval<'T> which is defined as a discriminated union with two cases: Success containing a value, or Error containing an exception. Using tryval<'T> as a value in a data frame is not generally recommended, because the type of values cannot be tracked in the type. For this reason, it is better to use tryval<'T> with individual series. However, `tryValues` and `fillErrorsWith` functions can be used to get values, or fill failed values inside an entire data frame. The `tryMapRows` function is more useful. It can be used to write a transformation that applies a computation (which may fail) to each row of a data frame. The resulting series is of type Series<'R, tryval<'T>> and can be processed using the Series module functions. Missing values -------------- This group of functions provides a way of working with missing values in a data frame. The category provides the following functions that can be used to fill missing values: * `fillMissingWith` fills missing values with a specified constant * `fillMissingUsing` calls a specified function for every missing value * `fillMissing` and variants propagates values from previous/later keys We use the terms _sparse_ and _dense_ to denote series that contain some missing values or do not contain any missing values, respectively. The functions `denseCols` and `denseRows` return a series that contains only dense columns or rows and all sparse rows or columns are replaced with a missing value. The `dropSparseCols` and `dropSparseRows` functions drop these missing values and return a frame with no missing values. Joining, merging and zipping ---------------------------- The simplest way to join two frames is to use the `join` operation which can be used to perform left, right, outer or inner join of two frames. When the row keys of the frames do not match exactly, you can use `joinAlign` which takes an additional parameter that specifies how to find matching key in left/right join (e.g. by taking the nearest smaller available key). Frames that do not contian overlapping values can be combined using `merge` (when combining just two frames) or using `mergeAll` (for larger number of frames). Tha latter is optimized to work well for a large number of data frames. Finally, frames with overlapping values can be combined using `zip`. It takes a function that is used to combine the overlapping values. A `zipAlign` function provides a variant with more flexible row key matching (as in `joinAlign`) Hierarchical index operations ----------------------------- A data frame has a hierarchical row index if the row index is formed by a tuple, such as Frame<'R1 * 'R2, 'C>. Frames of this kind are returned, for example, by the grouping functions such as Frame.groupRowsBy. The functions in this category provide ways for working with data frames that have hierarchical row keys. The functions applyLevel and reduceLevel can be used to reduce values according to one of the levels. The applyLevel function takes a reduction of type Series<'K, 'T> -> 'T while reduceLevel reduces individual values using a function of type 'T -> 'T -> 'T. The functions nest and unnest can be used to convert between frames with hierarchical indices (Frame<'K1 * 'K2, 'C>) and series of frames that represent individual groups (Series<'K1, Frame<'K2, 'C>>). The nestBy function can be used to perform group by operation and return the result as a series of frems.

Table of contents

Other module members

Functions and values

Function or value Description

fillErrorsWith value frame

Full Usage: fillErrorsWith value frame

Parameters:
    value : 'T
    frame : Frame<'R, 'C>

Returns: Frame<'R, 'C>

Fills all error cases of a `tryval<'T>` value in a data frame with the specified `value`. The function takes all columns of type `tryval<'T>` and uses `Series.fillErrorsWith` to fill the error values with the specified default value. Processing frames with exceptions

value : 'T
frame : Frame<'R, 'C>
Returns: Frame<'R, 'C>

getRow row frame

Full Usage: getRow row frame

Parameters:
    row : 'R
    frame : Frame<'R, 'C>

Returns: Series<'C, 'T>
Modifiers: inline
Type parameters: 'R, 'C, 'T

Returns a specified row from a data frame. This function uses exact matching semantics on the key. Use `lookupRow` if you want to use inexact matching (e.g. on dates) Accessing frame data and lookup

row : 'R
frame : Frame<'R, 'C>
Returns: Series<'C, 'T>

getRows frame

Full Usage: getRows frame

Parameters:
Returns: Series<'R, Series<'C, 'T>>

Returns a series of rows of the data frame indexed by the row keys, which contains those rows whose values are convertible to 'T, and with missing values where the conversion fails. Accessing frame data and lookup

frame : Frame<'R, 'C>
Returns: Series<'R, Series<'C, 'T>>

groupRowsByBool column frame

Full Usage: groupRowsByBool column frame

Parameters:
    column : 'C
    frame : Frame<'R, 'C>

Returns: Frame<(bool * 'R), 'C>

Groups the rows of a frame by a specified column in the same way as `groupRowsBy`. This function assumes that the values of the specified column are of type `bool`. Grouping, windowing and chunking

column : 'C
frame : Frame<'R, 'C>
Returns: Frame<(bool * 'R), 'C>

groupRowsByIndex keySelector frame

Full Usage: groupRowsByIndex keySelector frame

Parameters:
    keySelector : 'R -> 'K
    frame : Frame<'R, 'C>

Returns: Frame<('K * 'R), 'C>

Group rows of a data frame using the specified `keySelector`. The selector is called with a key of each row and should return a new key. The result is a frame with multi-level index, here the first level is formed by the newly created keys. Grouping, windowing and chunking

keySelector : 'R -> 'K
frame : Frame<'R, 'C>
Returns: Frame<('K * 'R), 'C>

groupRowsByInt column frame

Full Usage: groupRowsByInt column frame

Parameters:
    column : 'C
    frame : Frame<'R, 'C>

Returns: Frame<(int * 'R), 'C>

Groups the rows of a frame by a specified column in the same way as `groupRowsBy`. This function assumes that the values of the specified column are of type `int`. Grouping, windowing and chunking

column : 'C
frame : Frame<'R, 'C>
Returns: Frame<(int * 'R), 'C>

groupRowsByObj column frame

Full Usage: groupRowsByObj column frame

Parameters:
    column : 'C
    frame : Frame<'R, 'C>

Returns: Frame<(obj * 'R), 'C>

Groups the rows of a frame by a specified column in the same way as `groupRowsBy`. This function assumes that the values of the specified column are of type `obj`. Grouping, windowing and chunking

column : 'C
frame : Frame<'R, 'C>
Returns: Frame<(obj * 'R), 'C>

groupRowsByString column frame

Full Usage: groupRowsByString column frame

Parameters:
    column : 'C
    frame : Frame<'R, 'C>

Returns: Frame<(string * 'R), 'C>

Groups the rows of a frame by a specified column in the same way as `groupRowsBy`. This function assumes that the values of the specified column are of type `string`. Grouping, windowing and chunking

column : 'C
frame : Frame<'R, 'C>
Returns: Frame<(string * 'R), 'C>

indexRowsOrdinally frame

Full Usage: indexRowsOrdinally frame

Parameters:
    frame : Frame<'TRowKey, 'TColumnKey>

Returns: Frame<int, 'TColumnKey>

Replace the row index of the frame with ordinarilly generated integers starting from zero. The rows of the frame are assigned index according to the current order, or in a non-deterministic way, if the current row index is not ordered. Sorting and index manipulation

frame : Frame<'TRowKey, 'TColumnKey>
Returns: Frame<int, 'TColumnKey>

lookupCol column lookup frame

Full Usage: lookupCol column lookup frame

Parameters:
Returns: Series<'R, 'V>

Returns a specified series (column) from a data frame. If the data frame has ordered column index, the lookup semantics can be used to get series with nearest greater/smaller key. For exact semantics, you can use `getCol`. Accessing frame data and lookup

column : 'C
lookup : Lookup
frame : Frame<'R, 'C>
Returns: Series<'R, 'V>

lookupRow row lookup frame

Full Usage: lookupRow row lookup frame

Parameters:
Returns: Series<'C, 'T>
Modifiers: inline
Type parameters: 'R, 'C, 'T

Returns a specified row from a data frame. If the data frame has ordered row index, the lookup semantics can be used to get row with nearest greater/smaller key. For exact semantics, you can use `getRow`. Accessing frame data and lookup

row : 'R
lookup : Lookup
frame : Frame<'R, 'C>
Returns: Series<'C, 'T>

melt frame

Full Usage: melt frame

Parameters:
Returns: Frame<int, string>

Returns a data frame with three columns named `Row`, `Column` and `Value` that contains the data of the original data frame in individual rows. Grouping, windowing and chunking

frame : Frame<'R, 'C>
Returns: Frame<int, string>

meltBy idCols frame

Full Usage: meltBy idCols frame

Parameters:
    idCols : 'C seq
    frame : Frame<'R, 'C>

Returns: Frame<int, string>
 Similar to `melt`, but keeps the specified identity columns as-is and melts
 the remaining columns into `Column` and `Value` pairs. This is analogous to
 pandas `DataFrame.melt(id_vars=...)` or R's `data.table::melt`.

 ## Parameters
  - `idCols` - The columns to use as identity variables (kept in the output)
  - `frame` - The input data frame

 ## Returns
 A data frame with the identity columns followed by `Column` and `Value` columns.
 The row index is a sequential integer starting from 0.

 Grouping, windowing and chunking
idCols : 'C seq
frame : Frame<'R, 'C>
Returns: Frame<int, string>

mergeAll frames

Full Usage: mergeAll frames

Parameters:
    frames : Frame<'R, 'C> seq

Returns: Frame<'R, 'C>

Append a sequence of data frames with non-overlapping values. The operation takes the union of columns and rows of the source data frames and then unions the values. An exception is thrown when both data frames define value for a column/row location, but the operation succeeds if one all frames but one has a missing value at the location. Note that the rows are *not* automatically reindexed to avoid overlaps. This means that when a frame has rows indexed with ordinal numbers, you may need to explicitly reindex the row keys before calling append. Joining, merging and zipping

frames : Frame<'R, 'C> seq
Returns: Frame<'R, 'C>

nestBy keySelector frame

Full Usage: nestBy keySelector frame

Parameters:
    keySelector : 'K2 -> 'K1
    frame : Frame<'K2, 'C>

Returns: Series<'K1, Frame<'K2, 'C>>

Given a data frame, use the specified `keySelector` to generate a new, first-level of indices based on the current indices. Returns a series (indexed by the first-level) of frames (indexed by the second-level). Hierarchical index operations

keySelector : 'K2 -> 'K1
frame : Frame<'K2, 'C>
Returns: Series<'K1, Frame<'K2, 'C>>

reduceLevel levelSel op frame

Full Usage: reduceLevel levelSel op frame

Parameters:
    levelSel : 'R -> 'K
    op : 'T -> 'T -> 'T
    frame : Frame<'R, 'C>

Returns: Frame<'K, 'C>

Reduce the values in each series according to the specified level of a hierarchical row key.

For each group of rows as specified by `levelSel`, the function reduces the values in each series using the preovided function `op` by applying `Series.reduceLevel`. Columns that cannot be converted to a type required by `op` are skipped. To sum the values in all numerical columns according to the first component of a two level row key `'K1 * 'K2`, you can use the following: df |> Frame.reduceLevel fst (fun (a:float) b -> a + b) This function reduces values using a function `'T -> 'T -> 'T`. If you want to process an entire group of values at once, you can use `applyLevel` instead. Hierarchical index operations

levelSel : 'R -> 'K
op : 'T -> 'T -> 'T
frame : Frame<'R, 'C>
Returns: Frame<'K, 'C>

rows frame

Full Usage: rows frame

Parameters:
Returns: RowSeries<'R, 'C>

Returns the rows of the data frame as a series (indexed by the row keys of the source frame) containing untyped series representing individual row of the frame. Accessing frame data and lookup

frame : Frame<'R, 'C>
Returns: RowSeries<'R, 'C>

skip count frame

Full Usage: skip count frame

Parameters:
    count : int
    frame : Frame<'R, 'C>

Returns: Frame<'R, 'C>

Returns a frame that contains the data from the original frame, except for the first `count` rows; `count` must be smaller or equal to the original number of rows. Frame transformations

count : int
frame : Frame<'R, 'C>
Returns: Frame<'R, 'C>

skipLast count frame

Full Usage: skipLast count frame

Parameters:
    count : int
    frame : Frame<'R, 'C>

Returns: Frame<'R, 'C>

Returns a frame that contains the data from the original frame, except for the last `count` rows; `count` must be smaller or equal to the original number of rows. Frame transformations

count : int
frame : Frame<'R, 'C>
Returns: Frame<'R, 'C>

slice columns rows frame

Full Usage: slice columns rows frame

Parameters:
    columns : 'C seq
    rows : 'R seq
    frame : Frame<'R, 'C>

Returns: Frame<'R, 'C>

Returns a frame consisting of the specified columns and rows from the original data frame. The function uses exact key matching semantics. Accessing frame data and lookup

columns : 'C seq
rows : 'R seq
frame : Frame<'R, 'C>
Returns: Frame<'R, 'C>

sliceCols columns frame

Full Usage: sliceCols columns frame

Parameters:
    columns : 'C seq
    frame : Frame<'R, 'C>

Returns: Frame<'R, 'C>

Returns a frame consisting of the specified columns from the original data frame. The function uses exact key matching semantics. Accessing frame data and lookup

columns : 'C seq
frame : Frame<'R, 'C>
Returns: Frame<'R, 'C>

sliceRows rows frame

Full Usage: sliceRows rows frame

Parameters:
    rows : 'R seq
    frame : Frame<'R, 'C>

Returns: Frame<'R, 'C>

Returns a frame consisting of the specified rows from the original data frame. The function uses exact key matching semantics. Accessing frame data and lookup

rows : 'R seq
frame : Frame<'R, 'C>
Returns: Frame<'R, 'C>

sortColsByKey frame

Full Usage: sortColsByKey frame

Parameters:
Returns: Frame<'R, 'C>

Returns a data frame that contains the same data as the input, but whose columns are an ordered series. This allows using operations that are only available on indexed series such as alignment and inexact lookup. Sorting and index manipulation

frame : Frame<'R, 'C>
Returns: Frame<'R, 'C>

sortRows colKey frame

Full Usage: sortRows colKey frame

Parameters:
    colKey : 'C
    frame : Frame<'R, 'C>

Returns: Frame<'R, 'C>

Returns a data frame that contains the same data as the input, but whose rows are ordered on a particular column of the frame. Sorting and index manipulation

colKey : 'C
frame : Frame<'R, 'C>
Returns: Frame<'R, 'C>

sortRowsBy colKey f frame

Full Usage: sortRowsBy colKey f frame

Parameters:
    colKey : 'C
    f : 'T -> 'V
    frame : Frame<'R, 'C>

Returns: Frame<'R, 'C>

Returns a data frame that contains the same data as the input, but whose rows are ordered on a particular column of the frame. Sorting and index manipulation

colKey : 'C
f : 'T -> 'V
frame : Frame<'R, 'C>
Returns: Frame<'R, 'C>

sortRowsByKey frame

Full Usage: sortRowsByKey frame

Parameters:
Returns: Frame<'R, 'C>

Returns a data frame that contains the same data as the input, but whose rows are an ordered series. This allows using operations that are only available on indexed series such as alignment and inexact lookup. Sorting and index manipulation

frame : Frame<'R, 'C>
Returns: Frame<'R, 'C>

sortRowsWith colKey compareFunc frame

Full Usage: sortRowsWith colKey compareFunc frame

Parameters:
    colKey : 'C
    compareFunc : 'a -> 'a -> int
    frame : Frame<'R, 'C>

Returns: Frame<'R, 'C>

Returns a data frame that contains the same data as the input, but whose rows are ordered on a particular column of the frame. Sorting and index manipulation

colKey : 'C
compareFunc : 'a -> 'a -> int
frame : Frame<'R, 'C>
Returns: Frame<'R, 'C>

strConcat frame1 frame2

Full Usage: strConcat frame1 frame2

Parameters:
Returns: Frame<'R, 'C>

Piecewise concatenate two frames of string values Joining, merging and zipping

frame1 : Frame<'R, 'C>
frame2 : Frame<'R, 'C>
Returns: Frame<'R, 'C>

take count frame

Full Usage: take count frame

Parameters:
    count : int
    frame : Frame<'R, 'C>

Returns: Frame<'R, 'C>

Returns a frame that contains the specified `count` of rows from the original frame; `count` must be smaller or equal to the original number of rows. Frame transformations

count : int
frame : Frame<'R, 'C>
Returns: Frame<'R, 'C>

takeLast count frame

Full Usage: takeLast count frame

Parameters:
    count : int
    frame : Frame<'R, 'C>

Returns: Frame<'R, 'C>

Returns a frame that contains the specified `count` of rows from the original frame. The rows are taken from the end of the frame; `count` must be smaller or equal to the original number of rows. Frame transformations

count : int
frame : Frame<'R, 'C>
Returns: Frame<'R, 'C>

toArray2D frame

Full Usage: toArray2D frame

Parameters:
Returns: float[,]

Returns data of the data frame as a 2D array containing data as `float` values. Missing data are represented as `Double.NaN` in the returned array. Accessing frame data and lookup

frame : Frame<'R, 'C>
Returns: float[,]

toJaggedArray frame

Full Usage: toJaggedArray frame

Parameters:
Returns: float array array

Returns data of the data frame as a jagged array containing data as `float` values. Missing data are represented as `Double.NaN` in the returned array. Accessing frame data and lookup

frame : Frame<'R, 'C>
Returns: float array array

tryLookupCol column lookup frame

Full Usage: tryLookupCol column lookup frame

Parameters:
Returns: Series<'R, 'V> option

Returns a specified series (column) from a data frame, or missing value if column doesn't exist. Accessing frame data and lookup

column : 'C
lookup : Lookup
frame : Frame<'R, 'C>
Returns: Series<'R, 'V> option

tryLookupColObservation column lookup frame

Full Usage: tryLookupColObservation column lookup frame

Parameters:
Returns: ('C * Series<'R, 'a>) option

Returns a specified key and series (column) from a data frame, or missing value if doesn't exist. Accessing frame data and lookup

column : 'C
lookup : Lookup
frame : Frame<'R, 'C>
Returns: ('C * Series<'R, 'a>) option

tryLookupRow row lookup frame

Full Usage: tryLookupRow row lookup frame

Parameters:
Returns: Series<'C, 'T> option
Modifiers: inline
Type parameters: 'R, 'C, 'T

Returns a specified series (row) from a data frame, or missing value if row doesn't exit. Accessing frame data and lookup

row : 'R
lookup : Lookup
frame : Frame<'R, 'C>
Returns: Series<'C, 'T> option

tryLookupRowObservation row lookup frame

Full Usage: tryLookupRowObservation row lookup frame

Parameters:
Returns: ('R * Series<'C, 'T>) option
Modifiers: inline
Type parameters: 'R, 'C, 'T

Returns a specified series (row) and key from a data frame, or missing value if row doesn't exit. Accessing frame data and lookup

row : 'R
lookup : Lookup
frame : Frame<'R, 'C>
Returns: ('R * Series<'C, 'T>) option

tryMapRows f frame

Full Usage: tryMapRows f frame

Parameters:
Returns: Series<'R, 'V tryval>

Returns a series, obtained by applying the specified projection function `f` to all rows of the input frame. The resulting series wraps the results in `tryval<'V>`. When the projection function fails, the exception is wrapped using the `Error` case. Processing frames with exceptions

f : 'R -> ObjectSeries<'C> -> 'V
frame : Frame<'R, 'C>
Returns: Series<'R, 'V tryval>

tryValues frame

Full Usage: tryValues frame

Parameters:
Returns: Frame<'R, 'C>

Given a data frame containing columns of type `tryval<'T>`, returns a new data frame that contains the underlying values of type `'T`. When the frame contains one or more failures, the operation throws `AggregateException`. Otherwise, it returns a frame containing values. Processing frames with exceptions

frame : Frame<'R, 'C>
Returns: Frame<'R, 'C>

unnest series

Full Usage: unnest series

Parameters:
Returns: Frame<('R1 * 'R2), 'C>

Given a series of frames, returns a new data frame with two-level hierarchical row index, using the series keys as the first component. This function is the dual of `Frame.nest`. Hierarchical index operations

series : Series<'R1, Frame<'R2, 'C>>
Returns: Frame<('R1 * 'R2), 'C>

Accessing frame data and lookup

Functions and values

Function or value Description

addCol column series frame

Full Usage: addCol column series frame

Parameters:
    column : 'C - A key (or name) for the newly added column
    series : Series<'R, 'V> - A data series to be added (the row key type has to match)
    frame : Frame<'R, 'C> - Source data frame (which is not mutated by the operation)

Returns: Frame<'R, 'C>

Creates a new data frame that contains all data from the original data frame, together with an additional series. The operation uses left join and aligns new series to the existing frame keys.

column : 'C

A key (or name) for the newly added column

series : Series<'R, 'V>

A data series to be added (the row key type has to match)

frame : Frame<'R, 'C>

Source data frame (which is not mutated by the operation)

Returns: Frame<'R, 'C>

cols frame

Full Usage: cols frame

Parameters:
Returns: ColumnSeries<'R, 'C>

Returns the columns of the data frame as a series (indexed by the column keys of the source frame) containing untyped series representing individual columns of the frame.

frame : Frame<'R, 'C>
Returns: ColumnSeries<'R, 'C>

countCols frame

Full Usage: countCols frame

Parameters:
Returns: int

Returns the total number of column keys in the specified frame. This returns the total length of columns, including keys for which there is no data available.

frame : Frame<'R, 'C>
Returns: int

countRows frame

Full Usage: countRows frame

Parameters:
Returns: int

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

frame : Frame<'R, 'C>
Returns: int

countValues frame

Full Usage: countValues frame

Parameters:
Returns: Series<'C, int>
Modifiers: inline
Type parameters: 'R, 'C

Returns a series with the total number of values in each column. This counts the number of actual values, excluding the missing values or not available values (such as `nan`, `null`, etc.)

frame : Frame<'R, 'C>
Returns: Series<'C, int>

dropCol column frame

Full Usage: dropCol column frame

Parameters:
    column : 'C - The key (or name) to be dropped from the frame
    frame : Frame<'R, 'C> - Source data frame (which is not mutated by the operation)

Returns: Frame<'R, 'C>

Creates a new data frame that contains all data from the original data frame without the specified series (column). The operation throws if the column key is not found.

column : 'C

The key (or name) to be dropped from the frame

frame : Frame<'R, 'C>

Source data frame (which is not mutated by the operation)

Returns: Frame<'R, 'C>

getCol column frame

Full Usage: getCol column frame

Parameters:
    column : 'C
    frame : Frame<'R, 'C>

Returns: Series<'R, 'V>

Returns a specified column from a data frame. This function uses exact matching semantics on the key. Use `lookupCol` if you want to use inexact matching (e.g. on dates)

column : 'C
frame : Frame<'R, 'C>
Returns: Series<'R, 'V>

getCols frame

Full Usage: getCols frame

Parameters:
Returns: Series<'C, Series<'R, 'T>>

Returns a series of columns of the data frame indexed by the column keys, which contains those series whose values are convertible to 'T, and with missing values where the conversion fails. If you want to get numeric columns, you can use a simpler `numericCols` function instead. Note that this function typically requires a type annotation. This can be specified in various ways, for example by annotating the result value: let (res:Series<_, Series<_, string>>) = frame |> getCols Here, the annotation on the values of the nested series specifies that we want to get columns containing `string` values.

frame : Frame<'R, 'C>
Returns: Series<'C, Series<'R, 'T>>

getNumericCols frame

Full Usage: getNumericCols frame

Parameters:
Returns: Series<'C, Series<'R, float>>

Returns a series of columns of the data frame indexed by the column keys, which contains those series whose values are convertible to float, and with missing values where the conversion fails.

frame : Frame<'R, 'C>
Returns: Series<'C, Series<'R, float>>

iloc rowPositions colPositions frame

Full Usage: iloc rowPositions colPositions frame

Parameters:
    rowPositions : int seq - Sequence of zero-based integer row positions to select
    colPositions : int seq - Sequence of zero-based integer column positions to select
    frame : Frame<'R, 'C> - Source data frame

Returns: Frame<'R, 'C>

Returns a sub-frame containing the rows and columns at the specified integer (zero-based) positions from the original data frame. Equivalent to pandas DataFrame.iloc[rows, cols].

rowPositions : int seq

Sequence of zero-based integer row positions to select

colPositions : int seq

Sequence of zero-based integer column positions to select

frame : Frame<'R, 'C>

Source data frame

Returns: Frame<'R, 'C>
Example

   // Select rows 0, 2 and columns 0, 1
   df |> Frame.iloc [0; 2] [0; 1]

ilocCols colPositions frame

Full Usage: ilocCols colPositions frame

Parameters:
    colPositions : int seq - Sequence of zero-based integer column positions to select
    frame : Frame<'R, 'C> - Source data frame

Returns: Frame<'R, 'C>

Returns a frame consisting of the columns at the specified integer (zero-based) positions from the original data frame. Equivalent to pandas iloc column selection.

colPositions : int seq

Sequence of zero-based integer column positions to select

frame : Frame<'R, 'C>

Source data frame

Returns: Frame<'R, 'C>

ilocRows rowPositions frame

Full Usage: ilocRows rowPositions frame

Parameters:
    rowPositions : int seq - Sequence of zero-based integer row positions to select
    frame : Frame<'R, 'C> - Source data frame

Returns: Frame<'R, 'C>

Returns a frame consisting of the rows at the specified integer (zero-based) positions from the original data frame. Equivalent to pandas iloc row selection.

rowPositions : int seq

Sequence of zero-based integer row positions to select

frame : Frame<'R, 'C>

Source data frame

Returns: Frame<'R, 'C>

replaceCol column series frame

Full Usage: replaceCol column series frame

Parameters:
    column : 'C - A key (or name) for the column to be replaced or added
    series : ISeries<'R> - A data series to be used (the row key type has to match)
    frame : Frame<'R, 'C> - Source data frame (which is not mutated by the operation)

Returns: Frame<'R, 'C>

Creates a new data frame where the specified column is replaced with a new series. (If the series does not exist, only the new series is added.)

column : 'C

A key (or name) for the column to be replaced or added

series : ISeries<'R>

A data series to be used (the row key type has to match)

frame : Frame<'R, 'C>

Source data frame (which is not mutated by the operation)

Returns: Frame<'R, 'C>

rowsAfter lowerExclusive frame

Full Usage: rowsAfter lowerExclusive frame

Parameters:
    lowerExclusive : 'R - The exclusive lower bound row key.
    frame : Frame<'R, 'C> - Source data frame.

Returns: Frame<'R, 'C>

Returns a new frame containing all rows with row keys strictly greater than lowerExclusive.

lowerExclusive : 'R

The exclusive lower bound row key.

frame : Frame<'R, 'C>

Source data frame.

Returns: Frame<'R, 'C>

rowsBefore upperExclusive frame

Full Usage: rowsBefore upperExclusive frame

Parameters:
    upperExclusive : 'R - The exclusive upper bound row key.
    frame : Frame<'R, 'C> - Source data frame.

Returns: Frame<'R, 'C>

Returns a new frame containing all rows with row keys strictly less than upperExclusive.

upperExclusive : 'R

The exclusive upper bound row key.

frame : Frame<'R, 'C>

Source data frame.

Returns: Frame<'R, 'C>

rowsBetween lowerInclusive upperInclusive frame

Full Usage: rowsBetween lowerInclusive upperInclusive frame

Parameters:
    lowerInclusive : 'R - The inclusive lower bound row key.
    upperInclusive : 'R - The inclusive upper bound row key.
    frame : Frame<'R, 'C> - Source data frame.

Returns: Frame<'R, 'C>

Returns a new frame containing all rows with row keys in the range [lowerInclusive, upperInclusive] (both bounds inclusive).

lowerInclusive : 'R

The inclusive lower bound row key.

upperInclusive : 'R

The inclusive upper bound row key.

frame : Frame<'R, 'C>

Source data frame.

Returns: Frame<'R, 'C>

rowsEndAt upperInclusive frame

Full Usage: rowsEndAt upperInclusive frame

Parameters:
    upperInclusive : 'R - The inclusive upper bound row key.
    frame : Frame<'R, 'C> - Source data frame.

Returns: Frame<'R, 'C>

Returns a new frame containing all rows with row keys less than or equal to upperInclusive.

upperInclusive : 'R

The inclusive upper bound row key.

frame : Frame<'R, 'C>

Source data frame.

Returns: Frame<'R, 'C>

rowsStartAt lowerInclusive frame

Full Usage: rowsStartAt lowerInclusive frame

Parameters:
    lowerInclusive : 'R - The inclusive lower bound row key.
    frame : Frame<'R, 'C> - Source data frame.

Returns: Frame<'R, 'C>

Returns a new frame containing all rows with row keys greater than or equal to lowerInclusive.

lowerInclusive : 'R

The inclusive lower bound row key.

frame : Frame<'R, 'C>

Source data frame.

Returns: Frame<'R, 'C>

Creating frames

Functions and values

Function or value Description

empty

Full Usage: empty

Returns: Frame<'R, 'C> An empty frame of type Frame<'R, 'C>.

Returns an empty data frame with no rows or columns.

Returns: Frame<'R, 'C>

An empty frame of type Frame<'R, 'C>.

Example

let df : Frame = Frame.empty

Frame transformations

Functions and values

Function or value Description

diff offset frame

Full Usage: diff offset frame

Parameters:
    offset : int - When positive, subtracts the past values from the current values; when negative, subtracts the future values from the current values.
    frame : Frame<'R, 'C> - The input frame containing at least some `float` columns.

Returns: Frame<'R, 'C>

Returns a frame with columns containing difference between an original value and a value at the specified offset. For example, calling `Frame.diff 1 s` returns a frame where previous column values is subtracted from the current ones. In pseudo-code, the function behaves as follows: result[k] = series[k] - series[k - offset] Columns that cannot be converted to `float` are left without a change.

offset : int

When positive, subtracts the past values from the current values; when negative, subtracts the future values from the current values.

frame : Frame<'R, 'C>

The input frame containing at least some `float` columns.

Returns: Frame<'R, 'C>

distinctRowsBy columns frame

Full Usage: distinctRowsBy columns frame

Parameters:
    columns : 'C seq
    frame : Frame<'R, 'C>

Returns: Frame<'R, 'C>
 Returns a new data frame containing only the rows of the input frame that have
 distinct values in the specified columns. When multiple rows have the same values
 in those columns, only the first row (in index order) is preserved.

 ## Parameters
  - `columns` - A sequence of column keys used to determine row uniqueness
  - `frame` - Input data frame to be transformed

 ## Example

     // Keep only the first row for each unique combination of "Category" and "Region"
     df |> Frame.distinctRowsBy ["Category"; "Region"]

 [category:Frame transformations]
columns : 'C seq
frame : Frame<'R, 'C>
Returns: Frame<'R, 'C>

filterColValues f frame

Full Usage: filterColValues f frame

Parameters:
    f : ObjectSeries<'R> -> bool - Function of one argument that defines the predicate
    frame : Frame<'R, 'C> - Input data frame to be transformed

Returns: Frame<'R, 'C>

Returns a new data frame containing only the columns of the input frame for which the specified predicate returns `true`. The predicate is called with an object series that represents the column data (use `filterCols` if you need to access the column key).

f : ObjectSeries<'R> -> bool

Function of one argument that defines the predicate

frame : Frame<'R, 'C>

Input data frame to be transformed

Returns: Frame<'R, 'C>

filterCols f frame

Full Usage: filterCols f frame

Parameters:
    f : 'C -> ObjectSeries<'R> -> bool - Function of two arguments that defines the predicate
    frame : Frame<'R, 'C> - Input data frame to be transformed

Returns: Frame<'R, 'C>

Returns a new data frame containing only the columns of the input frame for which the specified predicate returns `true`. The predicate is called with the column key and object series that represents the column data.

f : 'C -> ObjectSeries<'R> -> bool

Function of two arguments that defines the predicate

frame : Frame<'R, 'C>

Input data frame to be transformed

Returns: Frame<'R, 'C>

filterColsByMask mask frame

Full Usage: filterColsByMask mask frame

Parameters:
    mask : Series<'C, bool> - A series of boolean values indexed by the column key type
    frame : Frame<'R, 'C> - Input data frame to be filtered

Returns: Frame<'R, 'C>

Returns a new data frame containing only the columns of the input frame whose corresponding value in the boolean mask series is true. Columns whose key is missing from the mask are excluded. This enables pandas-style boolean indexing.

mask : Series<'C, bool>

A series of boolean values indexed by the column key type

frame : Frame<'R, 'C>

Input data frame to be filtered

Returns: Frame<'R, 'C>

filterRowValues f frame

Full Usage: filterRowValues f frame

Parameters:
    f : ObjectSeries<'C> -> bool - Function of one argument that defines the predicate
    frame : Frame<'R, 'C> - Input data frame to be transformed

Returns: Frame<'R, 'C>

Returns a new data frame containing only the rows of the input frame for which the specified predicate returns `true`. The predicate is called with an object series that represents the row data (use `filterRows` if you need to access the row key).

f : ObjectSeries<'C> -> bool

Function of one argument that defines the predicate

frame : Frame<'R, 'C>

Input data frame to be transformed

Returns: Frame<'R, 'C>

filterRows f frame

Full Usage: filterRows f frame

Parameters:
    f : 'R -> ObjectSeries<'C> -> bool - Function of two arguments that defines the predicate
    frame : Frame<'R, 'C> - Input data frame to be transformed

Returns: Frame<'R, 'C>

Returns a new data frame containing only the rows of the input frame for which the specified predicate returns `true`. The predicate is called with the row key and object series that represents the row data.

f : 'R -> ObjectSeries<'C> -> bool

Function of two arguments that defines the predicate

frame : Frame<'R, 'C>

Input data frame to be transformed

Returns: Frame<'R, 'C>

filterRowsBy column value frame

Full Usage: filterRowsBy column value frame

Parameters:
    column : 'C - The name of the column to be matched
    value : 'V - Required value of the column. Note that the function is generic and no conversions are performed, so the value has to match including the actual type.
    frame : Frame<'R, 'C> - Input data frame to be transformed

Returns: Frame<'R, 'C>

Returns a new data frame containing only the rows of the input frame for which the specified `column` has the specified `value`. The operation may be implemented via an index for virtualized Deedle frames.

column : 'C

The name of the column to be matched

value : 'V

Required value of the column. Note that the function is generic and no conversions are performed, so the value has to match including the actual type.

frame : Frame<'R, 'C>

Input data frame to be transformed

Returns: Frame<'R, 'C>

filterRowsByMask mask frame

Full Usage: filterRowsByMask mask frame

Parameters:
    mask : Series<'R, bool> - A series of boolean values indexed by the row key type
    frame : Frame<'R, 'C> - Input data frame to be filtered

Returns: Frame<'R, 'C>

Returns a new data frame containing only the rows of the input frame whose corresponding value in the boolean mask series is true. Rows whose key is missing from the mask are excluded. This enables pandas-style boolean indexing.

mask : Series<'R, bool>

A series of boolean values indexed by the row key type

frame : Frame<'R, 'C>

Input data frame to be filtered

Returns: Frame<'R, 'C>

map f frame

Full Usage: map f frame

Parameters:
    f : 'R -> 'C -> 'a -> 'b - Function that defines the mapping
    frame : Frame<'R, 'C> - Input data frame to be transformed

Returns: Frame<'R, 'C>

Builds a new data frame whose values are the results of applying the specified function on these values, but only for those columns which can be converted to the appropriate type for input to the mapping function.

f : 'R -> 'C -> 'a -> 'b

Function that defines the mapping

frame : Frame<'R, 'C>

Input data frame to be transformed

Returns: Frame<'R, 'C>

mapColKeys f frame

Full Usage: mapColKeys f frame

Parameters:
    f : 'C -> 'a - Function of one argument that defines the column key mapping
    frame : Frame<'R, 'C> - Input data frame to be transformed

Returns: Frame<'R, 'a>

Builds a new data frame whose column keys are the results of applying the specified function on the column keys of the original data frame.

f : 'C -> 'a

Function of one argument that defines the column key mapping

frame : Frame<'R, 'C>

Input data frame to be transformed

Returns: Frame<'R, 'a>

mapColValues f frame

Full Usage: mapColValues f frame

Parameters:
    f : ObjectSeries<'R> -> 'a - Function of one argument that defines the column mapping
    frame : Frame<'R, 'C> - Input data frame to be transformed

Returns: Frame<'b, 'C>

Builds a new data frame whose columns are the results of applying the specified function on the columns of the input data frame. The function is called with an object series that represents the column data (use `mapCols` if you need to access the column key).

f : ObjectSeries<'R> -> 'a

Function of one argument that defines the column mapping

frame : Frame<'R, 'C>

Input data frame to be transformed

Returns: Frame<'b, 'C>

mapColValuesAs f frame

Full Usage: mapColValuesAs f frame

Parameters:
    f : Series<'R, 'T> -> Series<'R, 'S> - Function of one argument that maps a typed series
    frame : Frame<'R, 'C> - Input data frame to be transformed

Returns: Frame<'R, 'C>

Builds a new data frame whose columns are the results of applying the specified function on the typed columns of the input data frame. Unlike mapColValues, this function avoids the boxing overhead of ObjectSeries by operating directly on columns converted to the specified type 'T. Columns that cannot be converted to 'T are silently dropped.

f : Series<'R, 'T> -> Series<'R, 'S>

Function of one argument that maps a typed series

frame : Frame<'R, 'C>

Input data frame to be transformed

Returns: Frame<'R, 'C>

mapCols f frame

Full Usage: mapCols f frame

Parameters:
    f : 'C -> ObjectSeries<'R> -> 'a - Function of two arguments that defines the column mapping
    frame : Frame<'R, 'C> - Input data frame to be transformed

Returns: Frame<'b, 'C>

Builds a new data frame whose columns are the results of applying the specified function on the columns of the input data frame. The function is called with the column key and object series that represents the column data.

f : 'C -> ObjectSeries<'R> -> 'a

Function of two arguments that defines the column mapping

frame : Frame<'R, 'C>

Input data frame to be transformed

Returns: Frame<'b, 'C>

mapRowKeys f frame

Full Usage: mapRowKeys f frame

Parameters:
    f : 'R1 -> 'R2 - Function of one argument that defines the row key mapping
    frame : Frame<'R1, 'C> - Input data frame to be transformed

Returns: Frame<'R2, 'C>

Builds a new data frame whose row keys are the results of applying the specified function on the row keys of the original data frame.

f : 'R1 -> 'R2

Function of one argument that defines the row key mapping

frame : Frame<'R1, 'C>

Input data frame to be transformed

Returns: Frame<'R2, 'C>

mapRowValues f frame

Full Usage: mapRowValues f frame

Parameters:
    f : ObjectSeries<'C> -> 'V - Function of one argument that defines the row mapping
    frame : Frame<'R, 'C> - Input data frame to be transformed

Returns: Series<'R, 'V>
Modifiers: inline
Type parameters: 'C, 'V, 'R

Builds a new data frame whose rows are the results of applying the specified function on the rows of the input data frame. The function is called with an object series that represents the row data (use `mapRows` if you need to access the row key).

f : ObjectSeries<'C> -> 'V

Function of one argument that defines the row mapping

frame : Frame<'R, 'C>

Input data frame to be transformed

Returns: Series<'R, 'V>

mapRows f frame

Full Usage: mapRows f frame

Parameters:
    f : 'R -> ObjectSeries<'C> -> 'V - Function of two arguments that defines the row mapping
    frame : Frame<'R, 'C> - Input data frame to be transformed

Returns: Series<'R, 'V>
Modifiers: inline
Type parameters: 'R, 'C, 'V

Builds a new data frame whose rows are the results of applying the specified function on the rows of the input data frame. The function is called with the row key and object series that represents the row data.

f : 'R -> ObjectSeries<'C> -> 'V

Function of two arguments that defines the row mapping

frame : Frame<'R, 'C>

Input data frame to be transformed

Returns: Series<'R, 'V>

mapValues f frame

Full Usage: mapValues f frame

Parameters:
    f : 'a -> 'b - Function that defines the mapping
    frame : Frame<'R, 'C> - Input data frame to be transformed

Returns: Frame<'R, 'C>

Builds a new data frame whose values are the results of applying the specified function on these values, but only for those columns which can be converted to the appropriate type for input to the mapping function (use `map` if you need to access the row and column keys).

f : 'a -> 'b

Function that defines the mapping

frame : Frame<'R, 'C>

Input data frame to be transformed

Returns: Frame<'R, 'C>

maxRowBy column frame

Full Usage: maxRowBy column frame

Parameters:
    column : 'C
    frame : Frame<'R, 'C>

Returns: ('R * ObjectSeries<'C>) option
Modifiers: inline
Type parameters: 'C, 'R

Returns a row of the data frame which has the greatest value of the specified `column`. The row is returned as an optional value (which is `None` for empty frame) and contains a key together with an object series representing the row.

column : 'C
frame : Frame<'R, 'C>
Returns: ('R * ObjectSeries<'C>) option

minRowBy column frame

Full Usage: minRowBy column frame

Parameters:
    column : 'C
    frame : Frame<'R, 'C>

Returns: ('R * ObjectSeries<'C>) option
Modifiers: inline
Type parameters: 'C, 'R

Returns a row of the data frame which has the smallest value of the specified `column`. The row is returned as an optional value (which is `None` for empty frame) and contains a key together with an object series representing the row.

column : 'C
frame : Frame<'R, 'C>
Returns: ('R * ObjectSeries<'C>) option

pctChange offset frame

Full Usage: pctChange offset frame

Parameters:
    offset : int - When positive, computes change from past values; when negative, computes change relative to future values.
    frame : Frame<'R, 'C> - The input frame containing at least some float columns.

Returns: Frame<'R, 'C>

Returns a frame where each value is the percentage change relative to the value at the specified offset. For example, calling Frame.pctChange 1 df returns a frame where each value represents the relative change from the previous row's value. In pseudo-code: result[k] = (frame[k] - frame[k - offset]) / frame[k - offset] Columns that cannot be converted to float are left without a change. This is commonly used in financial analysis to compute returns (e.g. daily stock returns).

offset : int

When positive, computes change from past values; when negative, computes change relative to future values.

frame : Frame<'R, 'C>

The input frame containing at least some float columns.

Returns: Frame<'R, 'C>

reduceValues op frame

Full Usage: reduceValues op frame

Parameters:
    op : 'T -> 'T -> 'T
    frame : Frame<'R, 'C>

Returns: Series<'C, 'T>

Returns a series that contains the results of aggregating each column to a single value. The function takes columns that can be converted to the type expected by the specified `op` function and reduces the values in each column using `Series.reduceValues`.

op : 'T -> 'T -> 'T
frame : Frame<'R, 'C>
Returns: Series<'C, 'T>
Example

The following sums the values in each column that can be converted to `float` and returns the result as a new series:

 df |> Frame.reduceValues (fun (a:float) b -> a + b)
Multiple items
val float: value: 'T -> float (requires member op_Explicit)

--------------------
type float = System.Double

--------------------
type float<'Measure> = float

shift offset frame

Full Usage: shift offset frame

Parameters:
    offset : int - Can be both positive and negative number.
    frame : Frame<'R, 'C> - The input frame whose columns are to be shifted.

Returns: Frame<'R, 'C>

Returns a frame with columns 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. `df - (Frame.shift 1 df)`, you can use `Frame.diff` which will be a little bit faster.

offset : int

Can be both positive and negative number.

frame : Frame<'R, 'C>

The input frame whose columns are to be shifted.

Returns: Frame<'R, 'C>

Grouping, windowing and chunking

Functions and values

Function or value Description

aggregateRowsBy groupBy aggBy aggFunc frame

Full Usage: aggregateRowsBy groupBy aggBy aggFunc frame

Parameters:
    groupBy : 'C seq - sequence of columns to group by
    aggBy : 'C seq - sequence of columns to apply aggFunc to
    aggFunc : Series<'R, 'V1> -> 'V2 - invoked in order to aggregate values
    frame : Frame<'R, 'C> - The input data frame to be aggregated

Returns: Frame<int, 'C>

Returns a data frame whose rows are grouped by `groupBy` and whose columns specified in `aggBy` are aggregated according to `aggFunc`.

groupBy : 'C seq

sequence of columns to group by

aggBy : 'C seq

sequence of columns to apply aggFunc to

aggFunc : Series<'R, 'V1> -> 'V2

invoked in order to aggregate values

frame : Frame<'R, 'C>

The input data frame to be aggregated

Returns: Frame<int, 'C>

groupRowsBy column frame

Full Usage: groupRowsBy column frame

Parameters:
    column : 'C
    frame : Frame<'R, 'C>

Returns: Frame<('K * 'R), 'C>

Group rows of a data frame using the specified `column`. The type of the column is inferred from the usage of the resulting frame. The result is a frame with multi-level index, where the first level is formed by the newly created keys. Use `groupRowsBy[Int|String|...]` to explicitly specify the type of the column.

column : 'C
frame : Frame<'R, 'C>
Returns: Frame<('K * 'R), 'C>

groupRowsUsing selector frame

Full Usage: groupRowsUsing selector frame

Parameters:
Returns: Frame<('K * 'R), 'C>

Group rows of a data frame using the specified `selector`. The selector is called with a row key and object series representing the row and should return a new key. The result is a frame with multi-level index, where the first level is formed by the newly created keys.

selector : 'R -> ObjectSeries<'C> -> 'K
frame : Frame<'R, 'C>
Returns: Frame<('K * 'R), 'C>

pivotTable rowGrp colGrp op frame

Full Usage: pivotTable rowGrp colGrp op frame

Parameters:
    rowGrp : 'R -> ObjectSeries<'C> -> 'RNew - A function from rowkey & row to group value for the resulting row index
    colGrp : 'R -> ObjectSeries<'C> -> 'CNew - A function from rowkey & row to group value for the resulting col index
    op : Frame<'R, 'C> -> 'T - A function computing a value from the corresponding bucket frame
    frame : Frame<'R, 'C> - The input data frame to pivot

Returns: Frame<'RNew, 'CNew>

Creates a new data frame resulting from a 'pivot' operation. Consider a denormalized data frame representing a table: column labels are field names & table values are observations of those fields. pivotTable buckets the rows along two axes, according to the results of the functions `rowGrp` and `colGrp`; and then computes a value for the frame of rows that land in each bucket.

rowGrp : 'R -> ObjectSeries<'C> -> 'RNew

A function from rowkey & row to group value for the resulting row index

colGrp : 'R -> ObjectSeries<'C> -> 'CNew

A function from rowkey & row to group value for the resulting col index

op : Frame<'R, 'C> -> 'T

A function computing a value from the corresponding bucket frame

frame : Frame<'R, 'C>

The input data frame to pivot

Returns: Frame<'RNew, 'CNew>

stack frame

Full Usage: stack frame

Parameters:
Returns: Frame<('R * 'C), string>

Converts a data frame to a long-format frame by combining the row index and the column index into a 2-tuple row index. Each cell of the original frame becomes a row in the result keyed by (rowKey, columnKey), with a single column named "Value". Missing values are dropped.

This is the pandas-style DataFrame.stack() operation. The inverse operation is Frame.unstack. To keep row/column keys in separate named columns instead, use Frame.melt.

frame : Frame<'R, 'C>
Returns: Frame<('R * 'C), string>

unmelt frame

Full Usage: unmelt frame

Parameters:
    frame : Frame<'O, string>

Returns: Frame<'R, 'C>

This function is the opposite of melt. It takes a data frame with three columns named Row, Column and Value and reconstructs a data frame by using Row and Column as row and column index keys, respectively.

frame : Frame<'O, string>
Returns: Frame<'R, 'C>

unstack frame

Full Usage: unstack frame

Parameters:
    frame : Frame<('R1 * 'R2), 'C>

Returns: Frame<'R1, ('C * 'R2)>

Converts a data frame with a 2-tuple row index into a wide-format frame by promoting the inner (second) element of each row key to the column index. The resulting frame has row keys equal to the unique first tuple elements and column keys of the form (originalColumnKey, innerRowKey). Cells with no corresponding entry in the input are represented as missing values.

This is the pandas-style DataFrame.unstack() operation and is the inverse of Frame.stack (modulo column-key wrapping when the input has more than one column).

frame : Frame<('R1 * 'R2), 'C>
Returns: Frame<'R1, ('C * 'R2)>

window size frame

Full Usage: window size frame

Parameters:
    size : int - The size of the sliding window.
    frame : Frame<'R, 'C> - The input frame to be aggregated.

Returns: Series<'R, Frame<'R, 'C>>

Creates a sliding window using the specified size. The result is a series containing data frames that represent individual windows. This function skips incomplete chunks.

size : int

The size of the sliding window.

frame : Frame<'R, 'C>

The input frame to be aggregated.

Returns: Series<'R, Frame<'R, 'C>>

windowInto size f frame

Full Usage: windowInto size f frame

Parameters:
    size : int - The size of the sliding window.
    f : Frame<'R, 'C> -> 'a - A function that is called on each created window.
    frame : Frame<'R, 'C> - The input frame to be aggregated.

Returns: Series<'R, 'a>

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.

size : int

The size of the sliding window.

f : Frame<'R, 'C> -> 'a

A function that is called on each created window.

frame : Frame<'R, 'C>

The input frame to be aggregated.

Returns: Series<'R, 'a>

Hierarchical index operations

Functions and values

Function or value Description

applyLevel levelSel op frame

Full Usage: applyLevel levelSel op frame

Parameters:
    levelSel : 'R -> 'K
    op : Series<'R, 'T> -> 'T
    frame : Frame<'R, 'C>

Returns: Frame<'K, 'C>

Apply a specified function to a group of values in each series according to the specified level of a hierarchical row key. For each group of rows as specified by `levelSel`, the function applies the specified function `op` to all columns. Columns that cannot be converted to a type required by `op` are skipped.

This function reduces a series of values using a function Series<'R, 'T> -> 'T. If you want to reduce values using a simpler function 'T -> 'T -> 'T, you can use `Frame.reduceLevel` instead.

levelSel : 'R -> 'K
op : Series<'R, 'T> -> 'T
frame : Frame<'R, 'C>
Returns: Frame<'K, 'C>
Example

To get the standard deviation of values in all numerical columns according to the first component of a two level row key 'K1 * 'K2, you can use the following:

 df |> Frame.applyLevel fst Stats.stdDev
val fst: tuple: ('T1 * 'T2) -> 'T1

nest frame

Full Usage: nest frame

Parameters:
    frame : Frame<('R1 * 'R2), 'C>

Returns: Series<'R1, Frame<'R2, 'C>>

Given a frame with two-level row index, returns a series indexed by the first part of the key, containing frames representing individual groups. This function can be used if you want to perform a transformation individually on each group (e.g. using `Series.mapValues` after calling `Frame.nest`).

frame : Frame<('R1 * 'R2), 'C>
Returns: Series<'R1, Frame<'R2, 'C>>

nestRowsBy groupSel rowSel frame

Full Usage: nestRowsBy groupSel rowSel frame

Parameters:
    groupSel : 'K -> 'K1
    rowSel : 'K -> 'K2
    frame : Frame<'K, 'C>

Returns: Series<'K1, Frame<'K2, 'C>>

Given a data frame, uses groupSel to determine the group key for each row, and rowSel to determine the inner row key within each group's sub-frame. Returns a series (indexed by the group key) of frames (indexed by the inner row key).

This is a generalisation of Frame.nestBy that lets you transform the inner row keys independently of the group keys. A common use-case is grouping a frame whose rows are already keyed by tuples: frame |> Frame.nestRowsBy fst snd groups by the first element and re-indexes each sub-frame by the second element.

groupSel : 'K -> 'K1
rowSel : 'K -> 'K2
frame : Frame<'K, 'C>
Returns: Series<'K1, Frame<'K2, 'C>>

Input and output

Functions and values

Function or value Description

saveJson path frame

Full Usage: saveJson path frame

Parameters:
    path : string - The output file path.
    frame : Frame<'R, 'C> - The data frame to serialize.

Save the data frame as a JSON file at the specified path.

path : string

The output file path.

frame : Frame<'R, 'C>

The data frame to serialize.

toJson orient frame

Full Usage: toJson orient frame

Parameters:
    orient : string - Controls the JSON layout: "columns" (default) produces a column-major object {"col":{"row":v,...},...}; "index" produces a row-major object {"row":{"col":v,...},...}; "records" produces an array of row objects [{"col":v,...},...].
    frame : Frame<'R, 'C> - The data frame to serialize.

Returns: string

Serialize the data frame to a JSON string.

orient : string

Controls the JSON layout: "columns" (default) produces a column-major object {"col":{"row":v,...},...}; "index" produces a row-major object {"row":{"col":v,...},...}; "records" produces an array of row objects [{"col":v,...},...].

frame : Frame<'R, 'C>

The data frame to serialize.

Returns: string

Joining, merging and zipping

Functions and values

Function or value Description

compare frame1 frame2

Full Usage: compare frame1 frame2

Parameters:
    frame1 : Frame<'R, 'C> - The first (original) frame.
    frame2 : Frame<'R, 'C> - The second (updated) frame to compare against.

Returns: Frame<'R, 'C>

Compares two frames column-by-column and returns a new frame of Diff values. Each cell describes whether the value was added, removed, or changed between the two frames. Columns present only in frame1 contribute Diff.Remove values; columns present only in frame2 contribute Diff.Add values; columns present in both are compared element-wise.

frame1 : Frame<'R, 'C>

The first (original) frame.

frame2 : Frame<'R, 'C>

The second (updated) frame to compare against.

Returns: Frame<'R, 'C>

join kind frame1 frame2

Full Usage: join kind frame1 frame2

Parameters:
    kind : JoinKind - Specifies the joining behavior on row indices. Use `JoinKind.Outer` and `JoinKind.Inner` to get the union and intersection of the row keys, respectively. Use `JoinKind.Left` and `JoinKind.Right` to use the current key of the left/right data frame.
    frame1 : Frame<'R, 'C> - First data frame (left) to be used in the joining
    frame2 : Frame<'R, 'C> - Other frame (right) to be joined with `frame1`

Returns: Frame<'R, 'C>

Join two data frames. The columns of the joined frames must not overlap and their rows are aligned and transformed according to the specified join kind. For more alignment options on ordered frames, see `joinAlign`.

kind : JoinKind

Specifies the joining behavior on row indices. Use `JoinKind.Outer` and `JoinKind.Inner` to get the union and intersection of the row keys, respectively. Use `JoinKind.Left` and `JoinKind.Right` to use the current key of the left/right data frame.

frame1 : Frame<'R, 'C>

First data frame (left) to be used in the joining

frame2 : Frame<'R, 'C>

Other frame (right) to be joined with `frame1`

Returns: Frame<'R, 'C>

joinAlign kind lookup frame1 frame2

Full Usage: joinAlign kind lookup frame1 frame2

Parameters:
    kind : JoinKind - Specifies the joining behavior on row indices. Use `JoinKind.Outer` and `JoinKind.Inner` to get the union and intersection of the row keys, respectively. Use `JoinKind.Left` and `JoinKind.Right` to use the current key of the left/right data frame.
    lookup : Lookup - When `kind` is `Left` or `Right` and the two frames have ordered row index, this parameter can be used to specify how to find value for a key when there is no exactly matching key or when there are missing values.
    frame1 : Frame<'R, 'C> - First data frame (left) to be used in the joining
    frame2 : Frame<'R, 'C> - Other frame (right) to be joined with `frame1`

Returns: Frame<'R, 'C>

Join two data frames. The columns of the joined frames must not overlap and their rows are aligned and transformed according to the specified join kind. When the index of both frames is ordered, it is possible to specify `lookup` in order to align indices from other frame to the indices of the main frame (typically, to find the nearest key with available value for a key).

kind : JoinKind

Specifies the joining behavior on row indices. Use `JoinKind.Outer` and `JoinKind.Inner` to get the union and intersection of the row keys, respectively. Use `JoinKind.Left` and `JoinKind.Right` to use the current key of the left/right data frame.

lookup : Lookup

When `kind` is `Left` or `Right` and the two frames have ordered row index, this parameter can be used to specify how to find value for a key when there is no exactly matching key or when there are missing values.

frame1 : Frame<'R, 'C>

First data frame (left) to be used in the joining

frame2 : Frame<'R, 'C>

Other frame (right) to be joined with `frame1`

Returns: Frame<'R, 'C>

joinOn kind colKey frame1 frame2

Full Usage: joinOn kind colKey frame1 frame2

Parameters:
    kind : JoinKind - Specifies the joining behavior on row indices. Use JoinKind.Outer and JoinKind.Inner to get the union and intersection of the row keys, respectively. Use JoinKind.Left and JoinKind.Right to use the current key of the left/right data frame.
    colKey : 'C - The name of the column to join on. This column must exist in both frames and must have unique values.
    frame1 : Frame<'R1, 'C> - First data frame (left) to be used in the joining.
    frame2 : Frame<'R2, 'C> - Other frame (right) to be joined with frame1.

Returns: Frame<'K, 'C>

Join two data frames on a shared column, using that column's values as the row index for alignment. Both frames must have unique values in the specified column (the unique-key case). The join column is removed from the data columns of the result and becomes the row index. This is a convenience wrapper around Frame.indexRows followed by Frame.join.

kind : JoinKind

Specifies the joining behavior on row indices. Use JoinKind.Outer and JoinKind.Inner to get the union and intersection of the row keys, respectively. Use JoinKind.Left and JoinKind.Right to use the current key of the left/right data frame.

colKey : 'C

The name of the column to join on. This column must exist in both frames and must have unique values.

frame1 : Frame<'R1, 'C>

First data frame (left) to be used in the joining.

frame2 : Frame<'R2, 'C>

Other frame (right) to be joined with frame1.

Returns: Frame<'K, 'C>

joinOnInt kind colKey frame1 frame2

Full Usage: joinOnInt kind colKey frame1 frame2

Parameters:
    kind : JoinKind - Specifies the joining behavior on row indices. Use JoinKind.Outer and JoinKind.Inner to get the union and intersection of the row keys, respectively. Use JoinKind.Left and JoinKind.Right to use the current key of the left/right data frame.
    colKey : 'C - The name of the column to join on.
    frame1 : Frame<'R1, 'C> - First data frame (left).
    frame2 : Frame<'R2, 'C> - Other frame (right).

Returns: Frame<int, 'C>

Join two data frames on a shared int-valued column. Both frames must have unique values in the specified column (the unique-key case). The join column becomes the row index of the result frame. This is the int-specialised variant of Frame.joinOn.

kind : JoinKind

Specifies the joining behavior on row indices. Use JoinKind.Outer and JoinKind.Inner to get the union and intersection of the row keys, respectively. Use JoinKind.Left and JoinKind.Right to use the current key of the left/right data frame.

colKey : 'C

The name of the column to join on.

frame1 : Frame<'R1, 'C>

First data frame (left).

frame2 : Frame<'R2, 'C>

Other frame (right).

Returns: Frame<int, 'C>

joinOnString kind colKey frame1 frame2

Full Usage: joinOnString kind colKey frame1 frame2

Parameters:
    kind : JoinKind - Specifies the joining behavior on row indices. Use JoinKind.Outer and JoinKind.Inner to get the union and intersection of the row keys, respectively. Use JoinKind.Left and JoinKind.Right to use the current key of the left/right data frame.
    colKey : 'C - The name of the column to join on.
    frame1 : Frame<'R1, 'C> - First data frame (left).
    frame2 : Frame<'R2, 'C> - Other frame (right).

Returns: Frame<string, 'C>

Join two data frames on a shared string-valued column. Both frames must have unique values in the specified column (the unique-key case). The join column becomes the row index of the result frame. This is the string-specialised variant of Frame.joinOn.

kind : JoinKind

Specifies the joining behavior on row indices. Use JoinKind.Outer and JoinKind.Inner to get the union and intersection of the row keys, respectively. Use JoinKind.Left and JoinKind.Right to use the current key of the left/right data frame.

colKey : 'C

The name of the column to join on.

frame1 : Frame<'R1, 'C>

First data frame (left).

frame2 : Frame<'R2, 'C>

Other frame (right).

Returns: Frame<string, 'C>

merge frame1 frame2

Full Usage: merge frame1 frame2

Parameters:
    frame1 : Frame<'R, 'C> - First of the two frames to be merged (combined)
    frame2 : Frame<'R, 'C> - The other frame to be merged (combined) with the first instance

Returns: Frame<'R, 'C>

Append two data frames with non-overlapping values. The operation takes the union of columns and rows of the source data frames and then unions the values. An exception is thrown when both data frames define value for a column/row location, but the operation succeeds if one frame has a missing value at the location. Note that the rows are *not* automatically reindexed to avoid overlaps. This means that when a frame has rows indexed with ordinal numbers, you may need to explicitly reindex the row keys before calling append.

frame1 : Frame<'R, 'C>

First of the two frames to be merged (combined)

frame2 : Frame<'R, 'C>

The other frame to be merged (combined) with the first instance

Returns: Frame<'R, 'C>

zip op frame1 frame2

Full Usage: zip op frame1 frame2

Parameters:
    op : 'V1 -> 'V2 -> 'V - A function that is applied to aligned values. The `Zip` operation is generic in the type of this function and the type of function is used to determine which values in the frames are zipped and which are left unchanged.
    frame1 : Frame<'R, 'C> - First frame to be aligned and zipped with the other instance
    frame2 : Frame<'R, 'C> - Other frame to be aligned and zipped with the first instance

Returns: Frame<'R, 'C>

Aligns two data frames using both column index and row index and apply the specified operation on values of a specified type that are available in both data frames. This overload uses `JoinKind.Outer` for both columns and rows. Once aligned, the call df1.Zip<T>(df2, f) applies the specifed function `f` on all `T` values that are available in corresponding locations in both frames. For values of other types, the value from `df1` is returned.

op : 'V1 -> 'V2 -> 'V

A function that is applied to aligned values. The `Zip` operation is generic in the type of this function and the type of function is used to determine which values in the frames are zipped and which are left unchanged.

frame1 : Frame<'R, 'C>

First frame to be aligned and zipped with the other instance

frame2 : Frame<'R, 'C>

Other frame to be aligned and zipped with the first instance

Returns: Frame<'R, 'C>

zipAlign columnKind rowKind lookup op frame1 frame2

Full Usage: zipAlign columnKind rowKind lookup op frame1 frame2

Parameters:
    columnKind : JoinKind - Specifies how to align columns (inner, outer, left or right join)
    rowKind : JoinKind - Specifies how to align rows (inner, outer, left or right join)
    lookup : Lookup - Specifies how to find matching value for a row (when using left or right join on rows)
    op : 'V1 -> 'V2 -> 'V - A function that is applied to aligned values. The `Zip` operation is generic in the type of this function and the type of function is used to determine which values in the frames are zipped and which are left unchanged.
    frame1 : Frame<'R, 'C> - First frame to be aligned and zipped with the other instance
    frame2 : Frame<'R, 'C> - Other frame to be aligned and zipped with the first instance

Returns: Frame<'R, 'C>

Aligns two data frames using both column index and row index and apply the specified operation on values of a specified type that are available in both data frames. The parameters `columnKind`, and `rowKind` can be specified to determine how the alginment works (similarly to `Join`). Column keys are always matched using `Lookup.Exact`, but `lookup` determines lookup for rows. Once aligned, the call df1.Zip<T>(df2, f) applies the specifed function `f` on all `T` values that are available in corresponding locations in both frames. For values of other types, the value from `df1` is returned.

columnKind : JoinKind

Specifies how to align columns (inner, outer, left or right join)

rowKind : JoinKind

Specifies how to align rows (inner, outer, left or right join)

lookup : Lookup

Specifies how to find matching value for a row (when using left or right join on rows)

op : 'V1 -> 'V2 -> 'V

A function that is applied to aligned values. The `Zip` operation is generic in the type of this function and the type of function is used to determine which values in the frames are zipped and which are left unchanged.

frame1 : Frame<'R, 'C>

First frame to be aligned and zipped with the other instance

frame2 : Frame<'R, 'C>

Other frame to be aligned and zipped with the first instance

Returns: Frame<'R, 'C>

Missing values

Functions and values

Function or value Description

denseCols frame

Full Usage: denseCols frame

Parameters:
Returns: ColumnSeries<'R, 'C>

Returns the columns of the data frame that do not have any missing values. The operation returns a series (indexed by the column keys of the source frame) containing _series_ representing individual columns of the frame. This is similar to `Columns`, but it skips columns that contain missing value in _any_ row.

frame : Frame<'R, 'C>
Returns: ColumnSeries<'R, 'C>

denseRows frame

Full Usage: denseRows frame

Parameters:
Returns: RowSeries<'R, 'C>

Returns the rows of the data frame that do not have any missing values. The operation returns a series (indexed by the row keys of the source frame) containing _series_ representing individual row of the frame. This is similar to `Rows`, but it skips rows that contain missing value in _any_ column.

frame : Frame<'R, 'C>
Returns: RowSeries<'R, 'C>

dropEmptyCols frame

Full Usage: dropEmptyCols frame

Parameters:
Returns: Frame<'R, 'C>

Creates a new data frame that drops those columns that are empty for each row. The resulting data frame has the same number of rows, but may have fewer columns (or no columns at all).

frame : Frame<'R, 'C>
Returns: Frame<'R, 'C>

dropEmptyRows frame

Full Usage: dropEmptyRows frame

Parameters:
Returns: Frame<'R, 'C>

Creates a new data frame that contains only those rows that are empty for each column. The resulting data frame has the same number of columns, but may have fewer rows (or no rows at all).

frame : Frame<'R, 'C>
Returns: Frame<'R, 'C>

dropSparseCols frame

Full Usage: dropSparseCols frame

Parameters:
Returns: Frame<'R, 'C>

Creates a new data frame that contains only those columns of the original data frame that are _dense_, meaning that they have a value for each row. The resulting data frame has the same number of rows, but may have fewer columns (or no columns at all).

frame : Frame<'R, 'C>
Returns: Frame<'R, 'C>

dropSparseRows frame

Full Usage: dropSparseRows frame

Parameters:
Returns: Frame<'R, 'C>

Creates a new data frame that contains only those rows of the original data frame that are _dense_, meaning that they have a value for each column. The resulting data frame has the same number of columns, but may have fewer rows (or no rows at all).

frame : Frame<'R, 'C>
Returns: Frame<'R, 'C>

dropSparseRowsBy colKey frame

Full Usage: dropSparseRowsBy colKey frame

Parameters:
    colKey : 'C
    frame : Frame<'R, 'C>

Returns: Frame<'R, 'C>

Creates a new data frame that contains only those rows of the original data frame for which the given column has a value (i.e., is not missing). The resulting data frame has the same number of columns, but may have fewer rows (or no rows at all).

colKey : 'C
frame : Frame<'R, 'C>
Returns: Frame<'R, 'C>

fillMissing direction frame

Full Usage: fillMissing direction frame

Parameters:
    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.
    frame : Frame<'R, 'C> - An input data frame that is to be filled

Returns: Frame<'R, 'C>

Fill missing values in the data frame with the nearest available value (using the specified direction). Note that the frame may still contain missing values after call to this function (e.g. if the first value is not available and we attempt to fill series with previous values). This operation can only be used on ordered frames.

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.

frame : Frame<'R, 'C>

An input data frame that is to be filled

Returns: Frame<'R, 'C>

fillMissingUsing f frame

Full Usage: fillMissingUsing f frame

Parameters:
    f : Series<'R, 'T> -> 'R -> 'T - A function that takes a series Series<R, T> together with a key `K` in the series and generates a value to be used in a place where the original series contains a missing value.
    frame : Frame<'R, 'C> - An input data frame that is to be filled

Returns: Frame<'R, 'C>

Fill missing values in the frame using the specified function. The specified function is called with all series and keys for which the frame does not contain value and the result of the call is used in place of the missing value. The operation is only applied to columns (series) that contain values of the same type as the return type of the provided filling function. The operation does not attempt to convert between numeric values (so a series containing `float` will not be converted to a series of `int`).

f : Series<'R, 'T> -> 'R -> 'T

A function that takes a series Series<R, T> together with a key `K` in the series and generates a value to be used in a place where the original series contains a missing value.

frame : Frame<'R, 'C>

An input data frame that is to be filled

Returns: Frame<'R, 'C>

fillMissingWith value frame

Full Usage: fillMissingWith value frame

Parameters:
    value : 'T - A constant value that is used to fill all missing values
    frame : Frame<'R, 'C> - An input data frame that is to be filled

Returns: Frame<'R, 'C>

Fill missing values of a given type in the frame with a constant value. The fill value is applied to columns whose element type matches the fill value type (using safe numeric widening). This includes both cases where the column type can be widened to the fill value type (e.g. decimal columns filled with a float value) and cases where the fill value can be widened to the column type (e.g. an integer fill value filling float columns). Columns whose element type is incompatible with the fill value type are left unchanged.

value : 'T

A constant value that is used to fill all missing values

frame : Frame<'R, 'C>

An input data frame that is to be filled

Returns: Frame<'R, 'C>

Sorting and index manipulation

Functions and values

Function or value Description

expandAllCols nesting frame

Full Usage: expandAllCols nesting frame

Parameters:
    nesting : int - The nesting level for expansion. When set to 0, nothing is done.
    frame : Frame<'R, string> - Input data frame whose columns will be expanded

Returns: Frame<'R, string>

Creates a new data frame where all columns are expanded based on runtime structure of the objects they store. The expansion is performed recrusively to the specified depth. A column can be expanded if it is Series<string, T> or IDictionary<K, V> or if it is any .NET object with readable properties.

nesting : int

The nesting level for expansion. When set to 0, nothing is done.

frame : Frame<'R, string>

Input data frame whose columns will be expanded

Returns: Frame<'R, string>

expandCols names frame

Full Usage: expandCols names frame

Parameters:
    names : string seq - Names of columns in the original data frame to be expanded
    frame : Frame<'R, string> - Input data frame whose columns will be expanded

Returns: Frame<'R, string>

Creates a new data frame where the specified columns are expanded based on runtime structure of the objects they store. A column can be expanded if it is Series<string, T> or IDictionary<K, V> or if it is any .NET object with readable properties.

Given a data frame with a series that contains tuples, you can expand the tuple members and get a frame with columns `S.Item1` and `S.Item2`: let df = frame [ "S" => series [ 1 => (1, "One"); 2 => (2, "Two") ] ] df |> Frame.expandCols ["S"]

names : string seq

Names of columns in the original data frame to be expanded

frame : Frame<'R, string>

Input data frame whose columns will be expanded

Returns: Frame<'R, string>

indexColsWith keys frame

Full Usage: indexColsWith keys frame

Parameters:
    keys : 'C2 seq - A collection of new column keys.
    frame : Frame<'R, 'C1> - Source data frame whose column index are to be replaced.

Returns: Frame<'R, 'C2>

Replace the column index of the frame with the provided sequence of column keys. The columns of the frame are assigned keys according to the provided order. The specified column is removed from the resulting frame.

keys : 'C2 seq

A collection of new column keys.

frame : Frame<'R, 'C1>

Source data frame whose column index are to be replaced.

Returns: Frame<'R, 'C2>

indexRows column frame

Full Usage: indexRows column frame

Parameters:
    column : 'C - The name of a column in the original data frame that will be used for the new index. Note that the values in the column need to be unique.
    frame : Frame<'R1, 'C> - Source data frame whose row index is to be replaced.

Returns: Frame<'R2, 'C>

Returns a data frame whose rows are indexed based on the specified column of the original data frame. The generic type parameter is specifies the type of the values in the required index column (and usually needs to be specified using a type annotation). The specified column is removed from the resulting frame.

column : 'C

The name of a column in the original data frame that will be used for the new index. Note that the values in the column need to be unique.

frame : Frame<'R1, 'C>

Source data frame whose row index is to be replaced.

Returns: Frame<'R2, 'C>

indexRowsApply column f frame

Full Usage: indexRowsApply column f frame

Parameters:
    column : 'C - The name of a column in the original data frame to use for the new index.
    f : 'V -> 'R2 - A function that converts a column value to the desired row key type.
    frame : Frame<'R1, 'C> - Source data frame whose row index is to be replaced.

Returns: Frame<'R2, 'C>

Returns a data frame whose rows are indexed based on the specified column of the original data frame, with each index value transformed by the given function. This is useful when the column contains values that need to be converted or parsed into the desired key type (for example, parsing date strings from a CSV file). The specified column is removed from the resulting frame.

column : 'C

The name of a column in the original data frame to use for the new index.

f : 'V -> 'R2

A function that converts a column value to the desired row key type.

frame : Frame<'R1, 'C>

Source data frame whose row index is to be replaced.

Returns: Frame<'R2, 'C>
Example

// Index by a "Date" string column, parsing each value as a DateTime frame |> Frame.indexRowsApply "Date" System.DateTime.Parse // Index by an "Id" column, converting strings to integers frame |> Frame.indexRowsApply "Id" int

indexRowsDateTime column frame

Full Usage: indexRowsDateTime column frame

Parameters:
    column : 'C - The name of a column in the original data frame that will be used for the new index. Note that the values in the column need to be unique.
    frame : Frame<'R1, 'C> - Source data frame whose row index is to be replaced.

Returns: Frame<DateTime, 'C>

Returns a data frame whose rows are indexed based on the specified column of the original data frame. This function casts (or converts) the column key to values of type `DateTime` (a generic variant that may require some type annotation is `Frame.indexRows`) The specified column is removed from the resulting frame.

column : 'C

The name of a column in the original data frame that will be used for the new index. Note that the values in the column need to be unique.

frame : Frame<'R1, 'C>

Source data frame whose row index is to be replaced.

Returns: Frame<DateTime, 'C>

indexRowsDateTimeOffset column frame

Full Usage: indexRowsDateTimeOffset column frame

Parameters:
    column : 'C - The name of a column in the original data frame that will be used for the new index. Note that the values in the column need to be unique.
    frame : Frame<'R1, 'C> - Source data frame whose row index is to be replaced.

Returns: Frame<DateTimeOffset, 'C>

Returns a data frame whose rows are indexed based on the specified column of the original data frame. This function casts (or converts) the column key to values of type `DateTimeOffset` (a generic variant that may require some type annotation is `Frame.indexRows`) The specified column is removed from the resulting frame.

column : 'C

The name of a column in the original data frame that will be used for the new index. Note that the values in the column need to be unique.

frame : Frame<'R1, 'C>

Source data frame whose row index is to be replaced.

Returns: Frame<DateTimeOffset, 'C>

indexRowsInt column frame

Full Usage: indexRowsInt column frame

Parameters:
    column : 'C - The name of a column in the original data frame that will be used for the new index. Note that the values in the column need to be unique.
    frame : Frame<'R1, 'C> - Source data frame whose row index is to be replaced.

Returns: Frame<int, 'C>

Returns a data frame whose rows are indexed based on the specified column of the original data frame. This function casts (or converts) the column key to values of type `int` (a generic variant that may require some type annotation is `Frame.indexRows`) The specified column is removed from the resulting frame.

column : 'C

The name of a column in the original data frame that will be used for the new index. Note that the values in the column need to be unique.

frame : Frame<'R1, 'C>

Source data frame whose row index is to be replaced.

Returns: Frame<int, 'C>

indexRowsObj column frame

Full Usage: indexRowsObj column frame

Parameters:
    column : 'C - The name of a column in the original data frame that will be used for the new index. Note that the values in the column need to be unique.
    frame : Frame<'R1, 'C> - Source data frame whose row index is to be replaced.

Returns: Frame<obj, 'C>

Returns a data frame whose rows are indexed based on the specified column of the original data frame. This function casts (or converts) the column key to values of type `obj` (a generic variant that may require some type annotation is `Frame.indexRows`) The specified column is removed from the resulting frame.

column : 'C

The name of a column in the original data frame that will be used for the new index. Note that the values in the column need to be unique.

frame : Frame<'R1, 'C>

Source data frame whose row index is to be replaced.

Returns: Frame<obj, 'C>

indexRowsString column frame

Full Usage: indexRowsString column frame

Parameters:
    column : 'C - The name of a column in the original data frame that will be used for the new index. Note that the values in the column need to be unique.
    frame : Frame<'R1, 'C> - Source data frame whose row index is to be replaced.

Returns: Frame<string, 'C>

Returns a data frame whose rows are indexed based on the specified column of the original data frame. This function casts (or converts) the column key to values of type `string` (a generic variant that may require some type annotation is `Frame.indexRows`) The specified column is removed from the resulting frame.

column : 'C

The name of a column in the original data frame that will be used for the new index. Note that the values in the column need to be unique.

frame : Frame<'R1, 'C>

Source data frame whose row index is to be replaced.

Returns: Frame<string, 'C>

indexRowsUsing f frame

Full Usage: indexRowsUsing f frame

Parameters:
    f : ObjectSeries<'C> -> 'R2 - A function from row (as object series) to new row key value
    frame : Frame<'R1, 'C> - Source data frame whose row index are to be replaced.

Returns: Frame<'R2, 'C>

Replace the row index of the frame with a sequence of row keys generated using a function invoked on each row.

f : ObjectSeries<'C> -> 'R2

A function from row (as object series) to new row key value

frame : Frame<'R1, 'C>

Source data frame whose row index are to be replaced.

Returns: Frame<'R2, 'C>

indexRowsWith keys frame

Full Usage: indexRowsWith keys frame

Parameters:
    keys : 'R2 seq - A collection of new row keys.
    frame : Frame<'R1, 'C> - Source data frame whose row index are to be replaced.

Returns: Frame<'R2, 'C>

Replace the row index of the frame with the provided sequence of row keys. The rows of the frame are assigned keys according to the provided order.

keys : 'R2 seq

A collection of new row keys.

frame : Frame<'R1, 'C>

Source data frame whose row index are to be replaced.

Returns: Frame<'R2, 'C>

rankRowsBy colKey frame

Full Usage: rankRowsBy colKey frame

Parameters:
    colKey : 'C - The column to rank by
    frame : Frame<'R, 'C> - The input data frame

Returns: Series<'R, int>

Returns a series containing the dense rank of each row in the data frame, ordered by the values in the specified column. The rank is 1-based: the row with the smallest column value receives rank 1. Rows with equal values receive the same rank. Rows where the specified column has a missing value receive a missing rank.

colKey : 'C

The column to rank by

frame : Frame<'R, 'C>

The input data frame

Returns: Series<'R, int>

realignRows keys frame

Full Usage: realignRows keys frame

Parameters:
    keys : 'R seq - A sequence of new row keys. The keys must have the same type as the original frame keys (because the rows are realigned).
    frame : Frame<'R, 'C> - Source data frame that is to be realigned.

Returns: Frame<'R, 'C>

Align the existing data to a specified collection of row keys. Values in the data frame that do not match any new key are dropped, new keys (that were not in the original data frame) are assigned missing values.

keys : 'R seq

A sequence of new row keys. The keys must have the same type as the original frame keys (because the rows are realigned).

frame : Frame<'R, 'C>

Source data frame that is to be realigned.

Returns: Frame<'R, 'C>

renameCol oldKey newKey frame

Full Usage: renameCol oldKey newKey frame

Parameters:
    oldKey : 'C - The current key of the column to rename.
    newKey : 'C - The new key to assign to that column.
    frame : Frame<'R, 'C> - Source data frame (which is not mutated by the operation).

Returns: Frame<'R, 'C>

Rename a single column of the data frame. Returns a new frame; does not mutate the original. If oldKey is not found, the frame is returned unchanged.

oldKey : 'C

The current key of the column to rename.

newKey : 'C

The new key to assign to that column.

frame : Frame<'R, 'C>

Source data frame (which is not mutated by the operation).

Returns: Frame<'R, 'C>

renameColsUsing mapping frame

Full Usage: renameColsUsing mapping frame

Parameters:
    mapping : 'C -> 'C2 - A function that maps each current column key to a new column key.
    frame : Frame<'R, 'C> - Source data frame (which is not mutated by the operation).

Returns: Frame<'R, 'C2>

Rename all columns of the data frame by applying the specified mapping function. Returns a new frame; does not mutate the original.

mapping : 'C -> 'C2

A function that maps each current column key to a new column key.

frame : Frame<'R, 'C>

Source data frame (which is not mutated by the operation).

Returns: Frame<'R, 'C2>

transpose frame

Full Usage: transpose frame

Parameters:
    frame : Frame<'R, 'TColumnKey>

Returns: Frame<'TColumnKey, 'R>

Returns a transposed data frame. The rows of the original data frame are used as the columns of the new one (and vice versa). Use this operation if you have a data frame and you mostly need to access its rows as a series (because accessing columns as a series is more efficient).

frame : Frame<'R, 'TColumnKey>
Returns: Frame<'TColumnKey, 'R>

Type something to start searching.