init(column:)
Creates a new column of doubles from a given column whose elements can be converted to doubles.
Declaration
init<T>(column: MLDataColumn<T>) where T : MLDataValueConvertibleParameters
- column:
An Mldatacolumn of elements convertible to Double.
Discussion
Use this initializer to create a column of doubles from another column. Start by creating a column that is convertible to a column of doubles.
let stringsColumn = MLDataColumn(["1.0", "2.0", "3.0", "4.0", "5.0"])
print(stringsColumn) // Prints ["1.0", "2.0", "3.0", "4.0", "5.0"]Then use init(column:) to convert the column to a column of doubles.
let doublesColumn = MLDataColumn<Double>(column: stringsColumn)
print(doublesColumn) // Prints [1.0, 2.0, 3.0, 4.0, 5.0]