<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 10.14.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CreateML",
  "identifier" : "/documentation/CreateML/MLDataColumn/init(column:)-s8g5",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Create ML",
      "CreateML"
    ],
    "preciseIdentifier" : "s:8CreateML12MLDataColumnVA2A0C5ValueO14DictionaryTypeVRszrlE6columnACyAGGACyqd__G_tcAA0cE11ConvertibleRd__lufc"
  },
  "title" : "init(column:)"
}
-->

# init(column:)

Creates a new column of machine learning dictionaries from a given column whose elements can be converted to
dictionaries.

```
init<T>(column: MLDataColumn<T>) where T : MLDataValueConvertible
```

## Parameters

`column`

An [`MLDataColumn`](/documentation/CreateML/MLDataColumn) of elements convertible to [`MLDataValue.DictionaryType`](/documentation/CreateML/MLDataValue/DictionaryType).

## Discussion

Use this initializer to create a column of dictionaries from another column. Start by creating a column that
is convertible to a column of dictionaries.

```swift
let intDictionaryString = "{1:\"one\", 2:\"two\", 3:\"three\"}"
let intDictionaryString2 = "{4:\"four\", 5:\"five\", 6:\"six\"}"
let stringsColumn = MLDataColumn([intDictionaryString, intDictionaryString2])

print(stringsColumn) // Prints ["{1:"one", 2:"two", 3:"three"}", "{4:"four", 5:"five", 6:"six"}"]
```

Then use [`init(column:)`](/documentation/CreateML/MLDataColumn/init(column:)-s8g5) to convert the column to a column of dictionaries.

```swift
let dictionaryColumn = MLDataColumn<MLDataValue.DictionaryType>(column: stringsColumn)
print(dictionaryColumn) // Prints [[1: one, 2: two, 3: three], [5: five, 4: four, 6: six]]
```

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)