Structure

MLDataTable.ParsingOptions

The options for parsing a comma-separated values (CSV) file into a data table for a machine learning model.

Declaration

struct MLDataTable.ParsingOptions

Overview

Use ParsingOptions only when importing a CSV file with init(contentsOf:options:), especially if your CSV file has special formatting or your data table only needs to import specific rows or columns.

Topics

Specifing the CSV File Format

var containsHeader: Bool

A Boolean value indicating whether an input CSV file contains a header.

var delimiter: String

The character that separates the data fields in a CSV file.

var lineTerminator: String

The character that represents the end of a line in a CSV file.

Handling Special Characters

var escape: String

The character that marks a C escape sequence in a CSV file.

var quote: String

The character that represents a quote (") in a CSV file.

var doubleQuote: Bool

A Boolean value indicating whether two consecutive quotes ("") represent a single quote (") in a CSV file.

Ignoring CSV Components

var skipRows: Int

The number of starting rows to skip from the start of a CSV file.

var skipInitialSpaces: Bool

A Boolean value indicating whether to ignore leading spaces of a data field.

var comment: String

The character that marks the beginning of a comment, or text to ignore, in a CSV file.

Limiting Rows and Columns

var maxRows: Int?

The maximum number of rows to import form a CSV file; otherwise nil to import all rows.

var selectColumns: [String]?

The list of column names to import from a CSV file; otherwise nil to import all columns.

Representing Missing Values

var missingValues: [String]

A list of strings that represent missing values in a CSV file.