F# Data


CsvProvider

Namespace: FSharp.Data

Typed representation of a CSV file.

Static parameters

Static parametersDescription
Sample
Signature: string (optional, default = "")

Location of a CSV sample file or a string containing a sample CSV document.

Separators
Signature: string (optional, default = "")

Column delimiter(s). Defaults to ,.

InferRows
Signature: int (optional, default = 1000)

Number of rows to use for inference. Defaults to 1000. If this is zero, all rows are used.

Schema
Signature: string (optional, default = "")

Optional column types, in a comma separated list. Valid types are int, int64, bool, float, decimal, date, guid, string, int?, int64?, bool?, float?, decimal?, date?, guid?, int option, int64 option, bool option, float option, decimal option, date option, guid option and string option. You can also specify a unit and the name of the column like this: Name (type<unit>), or you can override only the name. If you don't want to specify all the columns, you can reference the columns by name like this: ColumnName=type.

HasHeaders
Signature: bool (optional, default = true)

Whether the sample contains the names of the columns as its first line.

IgnoreErrors
Signature: bool (optional, default = false)

Whether to ignore rows that have the wrong number of columns or which can't be parsed using the inferred or specified schema. Otherwise an exception is thrown when these rows are encountered.

SkipRows
Signature: int (optional, default = 0)

Skips the first n rows of the CSV file.

AssumeMissingValues
Signature: bool (optional, default = false)

When set to true, the type provider will assume all columns can have missing values, even if in the provided sample all values are present. Defaults to false.

PreferOptionals
Signature: bool (optional, default = false)

When set to true, inference will prefer to use the option type instead of nullable types, double.NaN or "" for missing values. Defaults to false.

Quote
Signature: char (optional, default = '"')

The quotation mark (for surrounding values containing the delimiter). Defaults to ".

MissingValues
Signature: string (optional, default = "")

The set of strings recogized as missing values. Defaults to NaN,NA,N/A,#N/A,:,-,TBA,TBD.

CacheRows
Signature: bool (optional, default = true)

Whether the rows should be caches so they can be iterated multiple times. Defaults to true. Disable for large datasets.

Culture
Signature: string (optional, default = "")

The culture used for parsing numbers and dates. Defaults to the invariant culture.

Encoding
Signature: string (optional, default = "")

The encoding used to read the sample. You can specify either the character set name or the codepage number. Defaults to UTF8 for files, and to ISO-8859-1 the for HTTP requests, unless charset is specified in the Content-Type response header.

ResolutionFolder
Signature: string (optional, default = "")

A directory that is used when resolving relative file references (at design time and in hosted execution).

EmbeddedResource
Signature: string (optional, default = "")

When specified, the type provider first attempts to load the sample from the specified resource (e.g. 'MyCompany.MyAssembly, resource_name.csv'). This is useful when exposing types generated by the type provider.

Fork me on GitHub