<!--
{
  "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/MLUntypedColumn/init()",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Create ML"
    ],
    "preciseIdentifier" : "s:8CreateML15MLUntypedColumnVACycfc"
  },
  "title" : "init()"
}
-->

# init()

Creates an empty, invalid column used to remove an existing column from
a data table.

```
init()
```

## Return Value

An empty, invalid column.

## Discussion

Use this initializer to create an empty column that, when assigned to
the name of an existing column within a data table, will remove that
column from the table.

For example, to remove a column from a data table, first start with a
variable data table.

```swift
let data: [String: MLDataValueConvertible] = [
    "Day": ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"],
    "Temperature": [91.3, 85.8, 79.5, 83.4, 72.2]
]

var table = try MLDataTable(dictionary: data)

print(table)
/* Prints...
 Columns:
 Day    string
 Temperature    float
 Rows: 5
 Data:
 +----------------+----------------+
 | Day            | Temperature    |
 +----------------+----------------+
 | Monday         | 91.3           |
 | Tuesday        | 85.8           |
 | Wednesday      | 79.5           |
 | Thursday       | 83.4           |
 | Friday         | 72.2           |
 +----------------+----------------+
 [5 rows x 2 columns]
 */
```

Then use [`init()`](/documentation/CreateML/MLUntypedColumn/init()) to create an empty column.

```swift
let emptyColumn = MLUntypedColumn()
```

Finally, use [`subscript(_:)`](/documentation/CreateML/MLUntypedColumn/subscript(_:)-9hr32) to remove the
existing column from the data table by setting the empty column to the
name of that existing column.

```swift
// Remove the "Temperature" column from the data table
table["Temperature"] = emptyColumn

print(table)
/* Prints...
 Columns:
 Day    string
 Rows: 5
 Data:
 +----------------+
 | Day            |
 +----------------+
 | Monday         |
 | Tuesday        |
 | Wednesday      |
 | Thursday       |
 | Friday         |
 +----------------+
 [5 rows x 1 columns]
 */
```

---

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)