F# Frame extensions
Namespace: Deedle
This module contains F# functions and extensions for working with frames. This
includes operations for creating frames such as the frame
function, =>
operator
and Frame.ofRows
, Frame.ofColumns
and Frame.ofRowKeys
functions. The module
also provides additional F# extension methods including ReadCsv
, SaveCsv
and PivotTable
.
Table of contents
Frame construction
The functions and methods in this group can be used to create frames. If you are creating
a frame from a number of sample values, you can use frame
and the =>
operator (or the
=?>
opreator which is useful if you have multiple series of distinct types):
1: 2: |
|
Aside from this, the various type extensions let you write Frame.ofXyz
to construct frames
from data in various formats - Frame.ofRows
and Frame.ofColumns
create frame from a series
or a sequence of rows or columns; Frame.ofRecords
creates a frame from .NET objects using
Reflection and Frame.ofRowKeys
creates an empty frame with the specified keys.
Functions and values
Type extensions
Type extension | Description |
ofArray2D(array)
Signature: (array:'T [,]) -> Frame<int,int>
Type parameters: 'T |
Create data frame from a 2D array of values. The first dimension of the array is used as rows and the second dimension is treated as columns. Rows and columns of the returned frame are indexed with the element's offset in the array. Parameters
|
ofColumns(cols)
Signature: cols:Series<'C,'?497429> -> Frame<'R,'C>
Type parameters: 'C, '?497429, 'R |
Creates a frame from a series that maps column keys to a nested series containing values for each column. |
ofColumns(cols)
Signature: (cols:seq<'C * '?497433>) -> Frame<'R,'C>
Type parameters: 'C, '?497433, 'R |
Creates a frame from a sequence of column keys and column series pairs.
The column series can contain values of any type, but it has to be the same
for all the series - if you have heterogenously typed series, use |
ofRecords(series)
Signature: series:Series<'K,'R> -> Frame<'K,string>
Type parameters: 'K, 'R |
Creates a data frame from a series containing any .NET objects. The method uses reflection
over the specified type parameter |
ofRecords(values)
Signature: values:seq<'T> -> Frame<int,string>
Type parameters: 'T |
Creates a data frame from a sequence of any .NET objects. The method uses reflection
over the specified type parameter |
ofRecords(values, indexCol)
Signature: (values:IEnumerable * indexCol:string) -> Frame<'R,string>
Type parameters: 'R |
Creates a data frame from a sequence of any .NET objects. The method uses reflection
over the specified type parameter |
ofRowKeys(keys)
Signature: keys:seq<'R> -> Frame<'R,string>
Type parameters: 'R |
Creates a frame with the specified row keys, but no columns (and no data). This is useful if you want to build a frame gradually and restrict all the later added data to a sequence of row keys known in advance. |
ofRows(rows)
Signature: (rows:seq<'R * '?497419>) -> Frame<'R,'C>
Type parameters: 'R, '?497419, 'C |
Creates a frame from a sequence of row keys and row series pairs.
The row series can contain values of any type, but it has to be the same
for all the series - if you have heterogenously typed series, use |
ofRows(rows)
Signature: rows:Series<'R,'?497423> -> Frame<'R,'C>
Type parameters: 'R, '?497423, 'C |
Creates a frame from a series that maps row keys to a nested series containing values for each row. |
ofRowsOrdinal(rows)
Signature: rows:seq<'?497414> -> Frame<int,'K>
Type parameters: '?497414, 'K, 'V |
Creates a frame with ordinal Integer index from a sequence of rows. The column indices of individual rows are unioned, so if a row has fewer columns, it will be successfully added, but there will be missing values. |
ofValues(values)
Signature: (values:seq<'R * 'C * 'V>) -> Frame<'R,'C>
Type parameters: 'R, 'C, 'V |
Create a data frame from a sequence of tuples containing row key, column key and a value. |
Frame operations
The group contains two overloads of the F#-friendly version of the PivotTable
method.
Type extensions
Type extension | Description |
PivotTable(r, c, op)
Signature: (r:'TColumnKey * c:'TColumnKey * op:(Frame<'TRowKey,'TColumnKey> -> 'T)) -> Frame<'R,'C>
Type parameters: 'R, 'C, 'T |
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 values of
the columns Parameters
|
Input and output
This group of extensions includes a number of overloads for the ReadCsv
and SaveCsv
methods. The methods here are designed to be used from F# and so they are F#-style extensions
and they use F#-style optional arguments. In general, the overlads take either a path or
TextReader
/TextWriter
. Also note that ReadCsv<'R>(path, indexCol, ...)
lets you specify
the column to be used as the index.
Type extensions
Type extension | Description |
ReadCsv(...)
Signature: (path:string * indexCol:string * hasHeaders:bool option * inferTypes:bool option * inferRows:int option * schema:string option * separators:string option * culture:string option * maxRows:int option * missingValues:string [] option) -> Frame<'R,string>
Type parameters: 'R |
Load data frame from a CSV file. The operation automatically reads column names from the
CSV file (if they are present) and infers the type of values for each column. Columns
of primitive types ( Parameters
|
ReadCsv(...)
Signature: (path:string * hasHeaders:bool option * inferTypes:bool option * inferRows:int option * schema:string option * separators:string option * culture:string option * maxRows:int option * missingValues:string [] option) -> Frame<int,string>
|
Load data frame from a CSV file. The operation automatically reads column names from the
CSV file (if they are present) and infers the type of values for each column. Columns
of primitive types ( Parameters
|
ReadCsv(...)
Signature: (stream:Stream * hasHeaders:bool option * inferTypes:bool option * inferRows:int option * schema:string option * separators:string option * culture:string option * maxRows:int option * missingValues:string [] option) -> Frame<int,string>
|
Load data frame from a CSV file. The operation automatically reads column names from the
CSV file (if they are present) and infers the type of values for each column. Columns
of primitive types ( Parameters
|
ReadCsv(...)
Signature: (reader:TextReader * hasHeaders:bool option * inferTypes:bool option * inferRows:int option * schema:string option * separators:string option * culture:string option * maxRows:int option * missingValues:string [] option) -> Frame<int,string>
|
Load data frame from a CSV file. The operation automatically reads column names from the
CSV file (if they are present) and infers the type of values for each column. Columns
of primitive types ( Parameters
|
SaveCsv(...)
Signature: (writer:TextWriter * includeRowKeys:bool option * keyNames:seq<string> option * separator:char option * culture:CultureInfo option) -> unit
|
Save data frame to a CSV file or a Parameters
|
SaveCsv(...)
Signature: (path:string * includeRowKeys:bool option * keyNames:seq<string> option * separator:char option * culture:CultureInfo option) -> unit
|
Save data frame to a CSV file or a Parameters
|
SaveCsv(path, keyNames)
Signature: (path:string * keyNames:seq<string>) -> unit
|
Save data frame to a CSV file or to a Parameters
|
ToDataTable(rowKeyNames)
Signature: rowKeyNames:seq<string> -> DataTable
|
Returns the data of the frame as a .NET Parameters
|