init(ints:)
Creates a new column of integers by converting the elements of another column.
Declaration
init(ints: MLUntypedColumn)Parameters
- ints:
A column with elements that are convertible to integers.
Return Value
A new untyped column of integers; otherwise an invalid column if any element of the given column cannot be converted to Int.
Discussion
Use this initializer to create a column of integers from another column. As an example, to create a column with this initializer, first start with a column that is convertible to integers.
let stringColumn = MLUntypedColumn(["1", "2", "3", "4", "5"])
print(stringColumn)
/* Prints...
ValueType: String
Values: [1, 2, 3, 4, 5]
*/Then use init(ints:) to convert the column to a column of integers.
let intsColumn = MLUntypedColumn(ints: stringColumn)
print(intsColumn)
/* Prints...
ValueType: Int
Values: [1, 2, 3, 4, 5]
*/