Instance Method


Adds an untyped column to the table.


mutating func addColumn(_ newColumn: MLUntypedColumn, named: String)



A column to add to the data table.


The name of the new column.


Use this method to add an untyped column to a data table.

As an example, start with a data table variable.

let data: [String: MLDataValueConvertible] = [
    "Title": ["Alice in Wonderland", "Hamlet", "Treasure Island", "Peter Pan"],
    "Author": ["Lewis Carroll", "William Shakespeare", "Robert L. Stevenson", "J. M. Barrie"],
    "Pages": [124, 98, 280, 94],

var bookTable = try MLDataTable(dictionary: data)

Then use addColumn(_:named:) to add a column to the table.

let pagesColumn = MLUntypedColumn([124, 98, 280, 94])
bookTable.addColumn(pagesColumn, named: "Pages")

See Also

Adding Columns

struct MLDataColumn

A column of typed values in a data table.

struct MLUntypedColumn

A column of untyped values in a data table.