---
title: "map(_:)"
framework: createml
role: symbol
role_heading: Instance Method
path: "createml/mldatatable/map(_:)-3yamp"
---

# map(_:)

Creates a new column, potentially with missing values, by applying a given thread-safe transform to every row in the data table.

## Declaration

```swift
func map<T>(_ lazyTransform: @escaping (MLDataTable.Row) -> T?) -> MLDataColumn<T> where T : MLDataValueConvertible
```

## Parameters

- `lazyTransform`: A thread-safe row transformation function. The implementation of your transform must accept a row from the data table and return an optional type that conforms to doc://com.apple.createml/documentation/CreateML/MLDataValueConvertible. If the transform returns nil for a given row, the corresponding element in the new column will have a missing value.

## Return Value

Return Value A new MLDataColumn.

## Discussion

Discussion This mapping function is the same as map(_:) with the exception that this version’s lazyTransform parameter returns an optional (T?). Use this version of map() to create empty values by returning nil from your lazyTransform.
