<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 12.0.0 -",
    "tvOS: 15.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 8.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "TabularData",
  "identifier" : "/documentation/TabularData/DataFrame/Slice/filter(on:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "TabularData"
    ],
    "preciseIdentifier" : "s:11TabularData0B5FrameV5SliceV6filter2on_AeA8ColumnIDVyxG_SbxSgKXEtKlF"
  },
  "title" : "filter(on:_:)"
}
-->

# filter(on:_:)

Returns a selection of rows that satisfy a predicate in the columns you select by column identifier.

```
func filter<T>(on columnID: ColumnID<T>, _ isIncluded: (T?) throws -> Bool) rethrows -> DataFrame.Slice
```

## Parameters

`columnID`

The identifier of a column in the slice.

`isIncluded`

A predicate closure that receives an element of the column as its argument,
and returns a Boolean that indicates whether the slice includes the element’s row.

## Return Value

A data frame slice that contains the rows that satisfy the predicate.

---

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)