> For the complete documentation index, see [llms.txt](https://docs-v3.toucantoco.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs-v3.toucantoco.com/data-management-in-datahub/datasets-in-toucan/preparing-data/overview-of-youprep-tm/filter/filter-rows.md).

# Filter rows

The Filter step allows you to selectively include or exclude rows from your dataset based on specified conditions. This step is part of a data processing pipeline and can be used to modify data coming from datasets represented in rows and columns.

### Step parameters

**Condition**: This is where you define your filtering criteria. You can create three types of conditions:

* **Simple condition\***:
  * `Column`**(string)\***: Enter the name of the column you want to filter on.
  * `Operator`**\[operators]\***: Choose an operator to filter your data. defaults to `eq`
  * `Value`**\***: Enter the value to compare against (not required for `isnull` and `notnull` operators).
* **ADD CONDITION** : Combine multiple simple conditions that you can bind by either an "AND" or "OR" logical operator
* **ADD GROUP ()**: Add a group of simple conditions that you can bind by either an "AND" or "OR" logical operator. Note that you cannot nest a group of conditions in another group.

### Example

**Input**

<figure><img src="https://1809014303-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZxYYf1KpgarKMgMsDCrw%2Fuploads%2Fgit-blob-a411b421ef572c0e50e6f59f0fb69a9fa74e99b6%2Ffilter_input.png?alt=media" alt=""><figcaption><p>Filter rows - input</p></figcaption></figure>

**Configuration**

```json
{
    "condition": {
        "OR": [
            {
                "column": "department",
                "value": "IT",
                "operator": "eq"
            },
            {
                "column": "country",
                "value": "Canada",
                "operator": "eq"
            }
        ]
}
```

{% hint style="info" %}
Rows meeting any of these conditions will appear in the filter's output
{% endhint %}

**Output**

<figure><img src="https://1809014303-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZxYYf1KpgarKMgMsDCrw%2Fuploads%2Fgit-blob-eefaaac3c2c0dd0bc18cf3707192bf13caf333e8%2Ffilter_output.png?alt=media" alt=""><figcaption><p>Filter - filter rows - output</p></figcaption></figure>

{% hint style="info" %}
**\[Operators]**

The following operators are available for conditions:

* `eq` (equals)
* `ne` (doesn't equal to)
* `gt` (is greater than)
* `ge` (is greater than or equal to)
* `lt` (is less than)
* `le` (is less than or equal to)
* `in` (is one of)
* `nin` (is not one of)
* `matches` (matches pattern)
* `notmatches` (doesn't match pattern)
* `isnull` (is null)
* `notnull` (is not null)
* `from` (starting in/on)
* `until` (ending in/on)

`matches` and `notmatches` operators are used to test value against a regular expression.
{% endhint %}

{% hint style="info" %}
**Values**

`value` can be an arbitrary value depending on the selected operator (e.g a list when used with the `in` operator, or `null` when used with the `isnull` operator).

Value can be:

* a variable or
* a fixed value among
  * `date`,
  * `string`,
  * `int`,
  * `float`,
  * `array`

For date only `starting in/on`, `ending in/on`, `is null` ,`is not null` are available
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs-v3.toucantoco.com/data-management-in-datahub/datasets-in-toucan/preparing-data/overview-of-youprep-tm/filter/filter-rows.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
