<!--
{
  "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/MLDataTable/subscript(_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Subscript",
  "symbol" : {
    "kind" : "Instance Subscript",
    "modules" : [
      "Create ML"
    ],
    "preciseIdentifier" : "s:8CreateML11MLDataTableVyAA0C6ColumnVyxGSgSS_xmtcAA0C16ValueConvertibleRzluip"
  },
  "title" : "subscript(_:_:)"
}
-->

# subscript(_:_:)

Retrieves a column with the specified name and type.

```
subscript<T>(columnName: String, columnType: T.Type) -> MLDataColumn<T>? where T : MLDataValueConvertible { get }
```

## Parameters

`columnName`

The name of the column to extract.

`columnType`

The underlying type of the column’s content.

## Return Value

A new [`MLDataColumn`](/documentation/CreateML/MLDataColumn) with the specified name and type, if
it exists; otherwise `nil`.

## Overview

Use this subscript to get a typed [`MLDataColumn`](/documentation/CreateML/MLDataColumn), which is easier to
work with than a [`MLUntypedColumn`](/documentation/CreateML/MLUntypedColumn) returned from
[`subscript(_:)`](/documentation/CreateML/MLDataTable/subscript(_:)-3wjk).

---

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)