Deedle


FrameExtensions

Some comment

Table of contents

Data structure manipulation 

Summary 1

Static members

Static memberDescription
FrameExtensions.ExpandColumns(...)
Signature:(frame:Frame<'R,string> * names:seq<string>) -> Frame<'R,string>
Type parameters: 'R

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.

Example

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.ExpandColumns ["S"]

Parameters

  • names - Names of columns in the original data frame to be expanded
  • frame - Input data frame whose columns will be expanded
FrameExtensions.ExpandColumns(...)
Signature:(frame:Frame<'R,string> * nesting:int * dynamic:bool) -> Frame<'R,string>
Type parameters: 'R

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.

Parameters

  • nesting - The nesting level for expansion. When set to 0, nothing is done.
FrameExtensions.IndexColumnsWith(...)
Signature:(frame:Frame<'R,'C> * keys:seq<'TNewRowIndex>) -> Frame<'R,'TNewRowIndex>
Type parameters: 'R, 'C, 'TNewRowIndex

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 current order, or in a non-deterministic way, if the current column index is not ordered.

Parameters

  • frame - Source data frame whose column index are to be replaced.
  • keys - A collection of new column keys.
FrameExtensions.IndexRowsOrdinally(...)
Signature:frame:Frame<'TRowKey,'TColumnKey> -> Frame<int,'TColumnKey>
Type parameters: 'TRowKey, '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.

Parameters

  • frame - Source data frame whose row index are to be replaced.
FrameExtensions.IndexRowsWith(...)
Signature:(frame:Frame<'R,'C> * keys:seq<'TNewRowIndex>) -> Frame<'TNewRowIndex,'C>
Type parameters: 'R, 'C, 'TNewRowIndex

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 current order, or in a non-deterministic way, if the current row index is not ordered.

Parameters

  • frame - Source data frame whose row index are to be replaced.
  • keys - A collection of new row keys.
FrameExtensions.OrderColumns(frame)
Signature:frame:Frame<'TRowKey,'TColumnKey> -> Frame<'TRowKey,'TColumnKey>
Type parameters: 'TRowKey, 'TColumnKey

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.

Parameters

  • frame - Source data frame to be ordered.
FrameExtensions.OrderRows(frame)
Signature:frame:Frame<'TRowKey,'TColumnKey> -> Frame<'TRowKey,'TColumnKey>
Type parameters: 'TRowKey, 'TColumnKey

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.

Parameters

  • frame - Source data frame to be ordered.
FrameExtensions.RealignRows(frame, keys)
Signature:(frame:Frame<'R,'C> * keys:seq<'R>) -> Frame<'R,'C>
Type parameters: '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.

Parameters

  • frame - Source data frame that is to be realigned.
  • keys - A sequence of new row keys. The keys must have the same type as the original frame keys (because the rows are realigned).
FrameExtensions.Transpose(frame)
Signature:frame:Frame<'TRowKey,'TColumnKey> -> Frame<'TColumnKey,'TRowKey>
Type parameters: 'TRowKey, 'TColumnKey

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).

Parameters

  • frame - Source data frame to be transposed.

Fancy accessors 

Static members

Static memberDescription
FrameExtensions.GetRows(frame, rowKeys)
Signature:(frame:Frame<'TRowKey,'TColumnKey> * rowKeys:'TRowKey []) -> Frame<'TRowKey,'TColumnKey>
Type parameters: 'TRowKey, 'TColumnKey

Input and output 

Summary 2

Static members

Static memberDescription
FrameExtensions.SaveCsv(...)
Signature:(frame:Frame<'R,'C> * path:string * keyNames:seq<string> * separator:char * culture:CultureInfo) -> unit
Type parameters: 'R, 'C

Save data frame to a CSV file or to a Stream. When calling the operation, you can specify whether you want to save the row keys or not (and headers for the keys) and you can also specify the separator (use \t for writing TSV files). When specifying file name ending with .tsv, the \t separator is used automatically.

Parameters

  • path - Specifies the output file name where the CSV data should be written
  • keyNames - Specifies the CSV headers for row key (or keys, for multi-level index)
  • separator - Specify the column separator in the file (the default is \t for TSV files and , for CSV files)
  • culture - Specify the CultureInfo object used for formatting numerical data
FrameExtensions.SaveCsv(...)
Signature:(frame:Frame<'R,'C> * path:string * includeRowKeys:bool * keyNames:seq<string> * separator:char * culture:CultureInfo) -> unit
Type parameters: 'R, 'C

Save data frame to a CSV file or to a Stream. When calling the operation, you can specify whether you want to save the row keys or not (and headers for the keys) and you can also specify the separator (use \t for writing TSV files). When specifying file name ending with .tsv, the \t separator is used automatically.

Parameters

  • path - Specifies the output file name where the CSV data should be written
  • includeRowKeys - When set to true, the row key is also written to the output file
  • keyNames - Can be used to specify the CSV headers for row key (or keys, for multi-level index)
  • separator - Specify the column separator in the file (the default is \t for TSV files and , for CSV files)
  • culture - Specify the CultureInfo object used for formatting numerical data
FrameExtensions.SaveCsv(...)
Signature:(frame:Frame<'R,'C> * stream:Stream * includeRowKeys:bool * keyNames:seq<string> * separator:char * culture:CultureInfo) -> unit
Type parameters: 'R, 'C

Save data frame to a CSV file or to a Stream. When calling the operation, you can specify whether you want to save the row keys or not (and headers for the keys) and you can also specify the separator (use \t for writing TSV files). When specifying file name ending with .tsv, the \t separator is used automatically.

Parameters

  • stream - Specifies the output stream where the CSV data should be written
  • includeRowKeys - When set to true, the row key is also written to the output file
  • keyNames - Can be used to specify the CSV headers for row key (or keys, for multi-level index)
  • separator - Specify the column separator in the file (the default is \t for TSV files and , for CSV files)
  • culture - Specify the CultureInfo object used for formatting numerical data

Missing values 

Summary 3

Static members

Static memberDescription
FrameExtensions.DropSparseColumns(frame)
Signature:frame:Frame<'TRowKey,'TColumnKey> -> Frame<'TRowKey,'TColumnKey>
Type parameters: 'TRowKey, 'TColumnKey

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).

Parameters

  • frame - An input data frame that is to be filtered
FrameExtensions.DropSparseRows(frame)
Signature:frame:Frame<'TRowKey,'TColumnKey> -> Frame<'TRowKey,'TColumnKey>
Type parameters: 'TRowKey, 'TColumnKey

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).

Parameters

  • frame - An input data frame that is to be filtered
FrameExtensions.FillMissing(frame, f)
Signature:(frame:Frame<'TRowKey,'TColumnKey> * f:Func<Series<'TRowKey,'T>,'TRowKey,'T>) -> Frame<'TRowKey,'TColumnKey>
Type parameters: 'TRowKey, 'TColumnKey, 'T

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).

Parameters

  • frame - An input data frame that is to be filled
  • f - 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.
FrameExtensions.FillMissing(...)
Signature:(frame:Frame<'TRowKey,'TColumnKey> * direction:Direction) -> Frame<'TRowKey,'TColumnKey>
Type parameters: 'TRowKey, 'TColumnKey

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.

Parameters

  • frame - An input data frame that is to be filled
  • direction - Specifies the direction used when searching for the nearest available value. Backward means that we want to look for the first value with a smaller key while Forward searches for the nearest greater key.
FrameExtensions.FillMissing(...)
Signature:(frame:Frame<'TRowKey,'TColumnKey> * value:'T) -> Frame<'TRowKey,'TColumnKey>
Type parameters: 'TRowKey, 'TColumnKey, 'T

Fill missing values of a given type in the frame with a constant value. The operation is only applied to columns (series) that contain values of the same type as the provided filling value. The operation does not attempt to convert between numeric values (so a series containing float will not be converted to a series of int).

Parameters

  • frame - An input data frame that is to be filled
  • value - A constant value that is used to fill all missing values

Other type members 

Static members

Static memberDescription
FrameExtensions.Append(...)
Signature:(frame:Frame<'TRowKey,'TColumnKey> * rowKey:'TRowKey * row:ISeries<'TColumnKey>) -> Frame<'TRowKey,'TColumnKey>
Type parameters: 'TRowKey, 'TColumnKey
FrameExtensions.CountColumns(frame)
Signature:frame:Frame<'R,'C> -> int
Type parameters: 'R, 'C

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.

FrameExtensions.CountRows(frame)
Signature:frame:Frame<'R,'C> -> int
Type parameters: 'R, 'C

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.

FrameExtensions.Diff(frame, offset)
Signature:(frame:Frame<'TRowKey,'TColumnKey> * offset:int) -> Frame<'TRowKey,'TColumnKey>
Type parameters: 'TRowKey, 'TColumnKey
FrameExtensions.Flatten(...)
Signature:(frame:Frame<'R1,'C1> * keySelector:Func<'R1,'K> * valueSelector:Func<Series<'R1,obj>,'V>) -> Series<'C1,Series<'K,'V>>
Type parameters: 'R1, 'C1, 'K, 'V
FrameExtensions.FlattenRows(...)
Signature:(frame:Frame<'R,'C> * keySelector:Func<'R,'K> * op:Func<Frame<'R,'C>,'V>) -> Series<'K,'V>
Type parameters: 'R, 'C, 'K, 'V
FrameExtensions.GetRowsAt(...)
Signature:(frame:Frame<'TRowKey,'TColumnKey> * indices:int []) -> Frame<'TRowKey,'TColumnKey>
Type parameters: 'TRowKey, 'TColumnKey
FrameExtensions.GetSlice(...)
Signature:(series:RowSeries<('TRowKey1 * 'TRowKey2),'TColKey> * lo1:'K1 option * hi1:'K1 option * lo2:'K2 option * hi2:'K2 option) -> Frame<('TRowKey1 * 'TRowKey2),'TColKey>
Type parameters: 'TRowKey1, 'TRowKey2, 'TColKey, 'K1, 'K2
FrameExtensions.GetSlice(...)
Signature:(series:RowSeries<('TRowKey1 * 'TRowKey2),'TColKey> * k1:'TRowKey1 * lo2:'TRowKey2 option * hi2:'TRowKey2 option) -> Frame<('TRowKey1 * 'TRowKey2),'TColKey>
Type parameters: 'TRowKey1, 'TRowKey2, 'TColKey
FrameExtensions.GetSlice(...)
Signature:(series:RowSeries<('TRowKey1 * 'TRowKey2),'TColKey> * lo1:'TRowKey1 option * hi1:'TRowKey1 option * k2:'TRowKey2) -> Frame<('TRowKey1 * 'TRowKey2),'TColKey>
Type parameters: 'TRowKey1, 'TRowKey2, 'TColKey
FrameExtensions.GetSlice(...)
Signature:(series:RowSeries<('TRowKey1 * 'TRowKey2),'TColKey> * lo1:'TRowKey1 option * hi1:'TRowKey1 option * lo2:'TRowKey2 option * hi2:'TRowKey2 option) -> Frame<('TRowKey1 * 'TRowKey2),'TColKey>
Type parameters: 'TRowKey1, 'TRowKey2, 'TColKey
FrameExtensions.GetSlice(...)
Signature:(series:ColumnSeries<'TRowKey,('TColKey1 * 'TColKey2)> * lo1:'K1 option * hi1:'K1 option * lo2:'K2 option * hi2:'K2 option) -> Frame<'TRowKey,('TColKey1 * 'TColKey2)>
Type parameters: 'TRowKey, 'TColKey1, 'TColKey2, 'K1, 'K2
FrameExtensions.GetSlice(...)
Signature:(series:ColumnSeries<'TRowKey,('TColKey1 * 'TColKey2)> * k1:'TColKey1 * lo2:'TColKey2 option * hi2:'TColKey2 option) -> Frame<'TRowKey,('TColKey1 * 'TColKey2)>
Type parameters: 'TRowKey, 'TColKey1, 'TColKey2
FrameExtensions.GetSlice(...)
Signature:(series:ColumnSeries<'TRowKey,('TColKey1 * 'TColKey2)> * lo1:'TColKey1 option * hi1:'TColKey1 option * k2:'TColKey2) -> Frame<'TRowKey,('TColKey1 * 'TColKey2)>
Type parameters: 'TRowKey, 'TColKey1, 'TColKey2
FrameExtensions.GetSlice(...)
Signature:(series:ColumnSeries<'TRowKey,('TColKey1 * 'TColKey2)> * lo1:'TColKey1 option * hi1:'TColKey1 option * lo2:'TColKey2 option * hi2:'TColKey2 option) -> Frame<'TRowKey,('TColKey1 * 'TColKey2)>
Type parameters: 'TRowKey, 'TColKey1, 'TColKey2
FrameExtensions.Print(frame)
Signature:frame:Frame<'K,'V> -> unit
Type parameters: 'K, 'V
FrameExtensions.Reduce(...)
Signature:(frame:Frame<'TRowKey,'TColumnKey> * aggregation:Func<'T,'T,'T>) -> Series<'TColumnKey,'T>
Type parameters: 'TRowKey, 'TColumnKey, 'T
FrameExtensions.Select(...)
Signature:(frame:Frame<'TRowKey,'TColumnKey> * projection:Func<KeyValuePair<'TRowKey,ObjectSeries<'TColumnKey>>,int,'?5102>) -> Frame<'TRowKey,'?5103>
Type parameters: 'TRowKey, 'TColumnKey, '?5102, '?5103
FrameExtensions.Select(...)
Signature:(frame:Frame<'TRowKey,'TColumnKey> * projection:Func<KeyValuePair<'TRowKey,ObjectSeries<'TColumnKey>>,'?5097>) -> Frame<'TRowKey,'?5098>
Type parameters: 'TRowKey, 'TColumnKey, '?5097, '?5098
FrameExtensions.SelectColumnKeys(...)
Signature:(frame:Frame<'TRowKey,'TColumnKey> * projection:Func<KeyValuePair<'TColumnKey,OptionalValue<ObjectSeries<'TRowKey>>>,'?5111>) -> Frame<'TRowKey,'?5111>
Type parameters: 'TRowKey, 'TColumnKey, '?5111
FrameExtensions.SelectRowKeys(...)
Signature:(frame:Frame<'TRowKey,'TColumnKey> * projection:Func<KeyValuePair<'TRowKey,OptionalValue<ObjectSeries<'TColumnKey>>>,'?5107>) -> Frame<'?5107,'TColumnKey>
Type parameters: 'TRowKey, 'TColumnKey, '?5107
FrameExtensions.Shift(frame, offset)
Signature:(frame:Frame<'TRowKey,'TColumnKey> * offset:int) -> Frame<'TRowKey,'TColumnKey>
Type parameters: 'TRowKey, 'TColumnKey
FrameExtensions.Sum(frame)
Signature:frame:Frame<'R,'C> -> Series<'C,float>
Type parameters: 'R, 'C
FrameExtensions.ToDataTable(...)
Signature:(frame:Frame<'R,'C> * rowKeyNames:seq<string>) -> DataTable
Type parameters: 'R, 'C
FrameExtensions.Where(frame, condition)
Signature:(frame:Frame<'TRowKey,'TColumnKey> * condition:Func<KeyValuePair<'TRowKey,ObjectSeries<'TColumnKey>>,int,bool>) -> Frame<'TRowKey,'TColumnKey>
Type parameters: 'TRowKey, 'TColumnKey

Filters frame rows using the specified condtion. Returns a new data frame that contains rows for which the provided function returned false. The function is called with KeyValuePair containing the row key as the Key and Value gives access to the row series and a row index.

Parameters

  • frame - A data frame to invoke the filtering function on.
  • condition - A delegate that specifies the filtering condition.
FrameExtensions.Where(frame, condition)
Signature:(frame:Frame<'TRowKey,'TColumnKey> * condition:Func<KeyValuePair<'TRowKey,ObjectSeries<'TColumnKey>>,bool>) -> Frame<'TRowKey,'TColumnKey>
Type parameters: 'TRowKey, 'TColumnKey

Filters frame rows using the specified condtion. Returns a new data frame that contains rows for which the provided function returned false. The function is called with KeyValuePair containing the row key as the Key and Value gives access to the row series.

Parameters

  • frame - A data frame to invoke the filtering function on.
  • condition - A delegate that specifies the filtering condition.
FrameExtensions.Window(...)
Signature:(frame:Frame<'R,'C> * size:int * aggregate:Func<Frame<'R,'C>,'?5081>) -> Series<'R,'?5081>
Type parameters: 'R, 'C, '?5081
FrameExtensions.Window(frame, size)
Signature:(frame:Frame<'R,'C> * size:int) -> Series<'R,Frame<'R,'C>>
Type parameters: 'R, 'C
Fork me on GitHub