<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 11.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CreateML",
  "identifier" : "/documentation/CreateML/MLDataTable/pack(columnsNamed:to:type:filling:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Create ML",
      "CreateML"
    ],
    "preciseIdentifier" : "s:8CreateML11MLDataTableV4pack12columnsNamed2to4type7fillingACSSd_SSAC8PackTypeOAA0C5ValueOtF"
  },
  "title" : "pack(columnsNamed:to:type:filling:)"
}
-->

# pack(columnsNamed:to:type:filling:)

Creates a new data table with an additional column that contains the
combined values of the given columns.

```
func pack(columnsNamed: String..., to: String, type: MLDataTable.PackType = .sequence, filling: MLDataValue = MLDataValue.invalid) -> MLDataTable
```

## Parameters

`columnsNamed`

The name of the columns to compact.

`to`

The name of the new condensed column.

`type`

The collection type for the new column. Typically, the type is a
sequence or a dictionary.

`filling`

The value to fill in any missing values with.

## Return Value

A new data table.

## Discussion

This function performs the inverse of
[`unpack(columnNamed:valueTypes:indexSubset:keySubset:)`](/documentation/CreateML/MLDataTable/unpack(columnNamed:valueTypes:indexSubset:keySubset:)).

---

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)