addColumn(_:named:)
Adds an untyped column to the table.
Declaration
mutating func addColumn(_ newColumn: MLUntypedColumn, named: String)Parameters
- newColumn:
A column to add to the data table.
- named:
The name of the new column.
Discussion
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")