Logo Deedle

Frame Type

Provides static methods for creating frames, reading frame data from CSV files and database (via IDataReader). The type also provides global configuration for reflection-based expansion.

Table of contents

Configuration

Static members

Static member Description

Frame.CustomExpanders

Full Usage: Frame.CustomExpanders

Returns: Dictionary<Type, Func<obj, (string * Type * obj) seq>>

Configures how reflection-based expansion behaves - see also `df.ExpandColumns`. This (mutable, non-thread-safe) collection lets you specify custom expansion behavior for any type. This is a dictionary with types as keys and functions that implement the expansion as values.

Returns: Dictionary<Type, Func<obj, (string * Type * obj) seq>>
Example

For example, say you have a type `MyPair` with propreties `Item1` of type `int` and `Item2` of type `string` (and perhaps other properties which makes the default behavior inappropriate). You can register custom expander as:

 Frame.CustomExpanders.Add(typeof<MyPair>, fun v ->
   let a = v :?> MyPair
   [ "First", typeof<int>, box a.Item1;
     "Second", typeof<string>, box a.Item2 ] :> seq<_> )
val typeof<'T> : System.Type
Multiple items
val int: value: 'T -> int (requires member op_Explicit)

--------------------
type int = int32

--------------------
type int<'Measure> = int
val box: value: 'T -> objnull
Multiple items
val string: value: 'T -> string

--------------------
type string = System.String
Multiple items
val seq: sequence: 'T seq -> 'T seq

--------------------
type 'T seq = System.Collections.Generic.IEnumerable<'T>

Frame.NonExpandableInterfaces

Full Usage: Frame.NonExpandableInterfaces

Returns: ResizeArray<Type>

Configures how reflection-based expansion behaves - see also `df.ExpandColumns`. This (mutable, non-thread-safe) collection specifies interfaces whose implementations should not be expanded. By default, this includes collections such as IList.

Returns: ResizeArray<Type>

Frame.NonExpandableTypes

Full Usage: Frame.NonExpandableTypes

Returns: HashSet<Type>

Configures how reflection-based expansion behaves - see also `df.ExpandColumns`. This (mutable, non-thread-safe) collection specifies additional primitive (but reference) types that should not be expaneded. By default, this includes DateTime, string, etc.

Returns: HashSet<Type>

Input and output

Static members

Static member Description

Frame.ReadCsv(stream, ?hasHeaders, ?inferTypes, ?inferRows, ?schema, ?separators, ?culture, ?maxRows, ?missingValues, ?preferOptions, ?encoding)

Full Usage: Frame.ReadCsv(stream, ?hasHeaders, ?inferTypes, ?inferRows, ?schema, ?separators, ?culture, ?maxRows, ?missingValues, ?preferOptions, ?encoding)

Parameters:
    stream : Stream - Specifies the input stream, opened at the beginning of CSV data
    ?hasHeaders : bool - Specifies whether the input CSV file has header row (when not set, the default value is `true`)
    ?inferTypes : bool - Specifies whether the method should attempt to infer types of columns automatically (set this to `false` if you want to specify schema)
    ?inferRows : int - If `inferTypes=true`, this parameter specifies the number of rows to use for type inference. The default value is 100.
    ?schema : string - A string that specifies CSV schema. See the documentation for information about the schema format.
    ?separators : string - A string that specifies one or more (single character) separators that are used to separate columns in the CSV file. Use for example `";"` to parse semicolon separated files.
    ?culture : string - Specifies the name of the culture that is used when parsing values in the CSV file (such as `"en-US"`). The default is invariant culture.
    ?maxRows : int - The maximal number of rows that should be read from the CSV file.
    ?missingValues : string - An array of strings that contains values which should be treated as missing when reading the file. The default value is: "NaN"; "NA"; "#N/A"; ":"; "-"; "TBA"; "TBD".
    ?preferOptions : bool - Specifies whether to prefer optional values when parsing CSV data.
    ?encoding : Encoding - Specifies the character encoding to use when reading the CSV stream. When not set, UTF-8 with BOM detection is used.

Returns: 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 (`int`, `float`, etc.) are converted to the right type. Columns of other types (such as dates) are not converted automatically.

stream : Stream

Specifies the input stream, opened at the beginning of CSV data

?hasHeaders : bool

Specifies whether the input CSV file has header row (when not set, the default value is `true`)

?inferTypes : bool

Specifies whether the method should attempt to infer types of columns automatically (set this to `false` if you want to specify schema)

?inferRows : int

If `inferTypes=true`, this parameter specifies the number of rows to use for type inference. The default value is 100.

?schema : string

A string that specifies CSV schema. See the documentation for information about the schema format.

?separators : string

A string that specifies one or more (single character) separators that are used to separate columns in the CSV file. Use for example `";"` to parse semicolon separated files.

?culture : string

Specifies the name of the culture that is used when parsing values in the CSV file (such as `"en-US"`). The default is invariant culture.

?maxRows : int

The maximal number of rows that should be read from the CSV file.

?missingValues : string

An array of strings that contains values which should be treated as missing when reading the file. The default value is: "NaN"; "NA"; "#N/A"; ":"; "-"; "TBA"; "TBD".

?preferOptions : bool

Specifies whether to prefer optional values when parsing CSV data.

?encoding : Encoding

Specifies the character encoding to use when reading the CSV stream. When not set, UTF-8 with BOM detection is used.

Returns: Frame<int, string>

Frame.ReadCsv(location, ?hasHeaders, ?inferTypes, ?inferRows, ?schema, ?separators, ?culture, ?maxRows, ?missingValues, ?preferOptions, ?encoding)

Full Usage: Frame.ReadCsv(location, ?hasHeaders, ?inferTypes, ?inferRows, ?schema, ?separators, ?culture, ?maxRows, ?missingValues, ?preferOptions, ?encoding)

Parameters:
    location : string - Specifies a file name or an web location of the resource.
    ?hasHeaders : bool - Specifies whether the input CSV file has header row (when not set, the default value is `true`)
    ?inferTypes : bool - Specifies whether the method should attempt to infer types of columns automatically. Set to `false` to treat all columns as strings. When a `schema` is also provided and `inferTypes=false`, the schema overrides are still applied.
    ?inferRows : int - If `inferTypes=true`, this parameter specifies the number of rows to use for type inference. The default value is 100.
    ?schema : string - A string that specifies CSV schema. See the documentation for information about the schema format. Schema overrides are respected even when `inferTypes=false`.
    ?separators : string - A string that specifies one or more (single character) separators that are used to separate columns in the CSV file. Use for example `";"` to parse semicolon separated files.
    ?culture : string - Specifies the name of the culture that is used when parsing values in the CSV file (such as `"en-US"`). The default is invariant culture.
    ?maxRows : int - Specifies the maximum number of rows that will be read from the CSV file
    ?missingValues : string - An array of strings that contains values which should be treated as missing when reading the file. The default value is: "NaN"; "NA"; "#N/A"; ":"; "-"; "TBA"; "TBD".
    ?preferOptions : bool - Specifies whether to prefer optional values when parsing CSV data.
    ?encoding : Encoding - Specifies the character encoding to use when reading the CSV file. When not set, UTF-8 with BOM detection is used.

Returns: 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 (`int`, `float`, etc.) are converted to the right type. Columns of other types (such as dates) are not converted automatically.

location : string

Specifies a file name or an web location of the resource.

?hasHeaders : bool

Specifies whether the input CSV file has header row (when not set, the default value is `true`)

?inferTypes : bool

Specifies whether the method should attempt to infer types of columns automatically. Set to `false` to treat all columns as strings. When a `schema` is also provided and `inferTypes=false`, the schema overrides are still applied.

?inferRows : int

If `inferTypes=true`, this parameter specifies the number of rows to use for type inference. The default value is 100.

?schema : string

A string that specifies CSV schema. See the documentation for information about the schema format. Schema overrides are respected even when `inferTypes=false`.

?separators : string

A string that specifies one or more (single character) separators that are used to separate columns in the CSV file. Use for example `";"` to parse semicolon separated files.

?culture : string

Specifies the name of the culture that is used when parsing values in the CSV file (such as `"en-US"`). The default is invariant culture.

?maxRows : int

Specifies the maximum number of rows that will be read from the CSV file

?missingValues : string

An array of strings that contains values which should be treated as missing when reading the file. The default value is: "NaN"; "NA"; "#N/A"; ":"; "-"; "TBA"; "TBD".

?preferOptions : bool

Specifies whether to prefer optional values when parsing CSV data.

?encoding : Encoding

Specifies the character encoding to use when reading the CSV file. When not set, UTF-8 with BOM detection is used.

Returns: Frame<int, string>

Frame.ReadReader(reader)

Full Usage: Frame.ReadReader(reader)

Parameters:
Returns: Frame<int, string>

Read data from `IDataReader`. The method reads all rows from the data reader and for each row, gets all the columns. When a value is `DBNull`, it is treated as missing. The types of created vectors are determined by the field types reported by the data reader.

reader : IDataReader
Returns: Frame<int, string>

Type something to start searching.