F# Data


CsvFile

Namespace: FSharp.Data

Represents a CSV file. The lines are read on demand from reader. Columns are delimited by one of the chars passed by separators (defaults to just ,), and to escape the separator chars, the quote character will be used (defaults to "). If hasHeaders is true (the default), the first line read by reader will not be considered part of data. If ignoreErrors is true (the default is false), rows with a different number of columns from the header row (or the first row if headers are not present) will be ignored. The first skipRows lines will be skipped.

Instance members

Instance memberDescription
Append(rows)
Signature: rows:seq<'RowType> -> CsvFile<'RowType>

Returns a csv with the same rows as the original plus the provided rows appended

Cache()
Signature: unit -> CsvFile<'RowType>

Returns a new csv with the same rows as the original but which guarantees that each row will be only be read and parsed from the input at most once.

Filter(predicate)
Signature: predicate:Func<'RowType,bool> -> CsvFile<'RowType>

Returns a new csv containing only the rows for which the given predicate returns "true".

Headers
Signature: string [] option

The names of the columns

CompiledName: get_Headers

Map(mapping)
Signature: mapping:Func<'RowType,'RowType> -> CsvFile<'RowType>

Returns a new csv where every row has been transformed by the provided mapping function.

NumberOfColumns
Signature: int

The number of columns

CompiledName: get_NumberOfColumns

Quote
Signature: char

The quotation mark use for surrounding values containing separator chars

CompiledName: get_Quote

Rows
Signature: seq<'RowType>

The rows with data

CompiledName: get_Rows

Save(path, separator, quote)
Signature: (path:string * separator:char option * quote:char option) -> unit

Saves CSV to the specified file

Save(stream, separator, quote)
Signature: (stream:Stream * separator:char option * quote:char option) -> unit

Saves CSV to the specified stream

Save(writer, separator, quote)
Signature: (writer:TextWriter * separator:char option * quote:char option) -> unit

Saves CSV to the specified writer

SaveToString(separator, quote)
Signature: (separator:char option * quote:char option) -> string

Saves CSV to a string

Separators
Signature: string

The character(s) used as column separator(s)

CompiledName: get_Separators

Skip(count)
Signature: count:int -> CsvFile<'RowType>

Returns a csv that skips N rows and then yields the remaining rows.

SkipWhile(predicate)
Signature: predicate:Func<'RowType,bool> -> CsvFile<'RowType>

Returns a csv that, when iterated, skips rows while the given predicate returns true, and then yields the remaining rows.

Take(count)
Signature: count:int -> CsvFile<'RowType>

Returns a new csv with only the first N rows of the underlying csv.

TakeWhile(predicate)
Signature: predicate:Func<'RowType,bool> -> CsvFile<'RowType>

Returns a csv that, when iterated, yields rowswhile the given predicate returns true, and then returns no further rows.

Truncate(count)
Signature: count:int -> CsvFile<'RowType>

Returns a csv that when enumerated returns at most N rows.

Static members

Static memberDescription
AsyncLoad(...)
Signature: (uri:string * separators:string option * quote:char option * hasHeaders:bool option * ignoreErrors:bool option * skipRows:int option) -> Async<CsvFile>

Loads CSV from the specified uri asynchronously

Load(...)
Signature: (uri:string * separators:string option * quote:char option * hasHeaders:bool option * ignoreErrors:bool option * skipRows:int option) -> CsvFile

Loads CSV from the specified uri

Load(...)
Signature: (reader:TextReader * separators:string option * quote:char option * hasHeaders:bool option * ignoreErrors:bool option * skipRows:int option) -> CsvFile

Loads CSV from the specified reader

Load(...)
Signature: (stream:Stream * separators:string option * quote:char option * hasHeaders:bool option * ignoreErrors:bool option * skipRows:int option) -> CsvFile

Loads CSV from the specified stream

Parse(...)
Signature: (text:string * separators:string option * quote:char option * hasHeaders:bool option * ignoreErrors:bool option * skipRows:int option) -> CsvFile

Parses the specified CSV content

Fork me on GitHub