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