> For the complete documentation index, see [llms.txt](https://docs.rasgoml.com/rasgo-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.rasgoml.com/rasgo-docs/rasgo-0.1/all-transforms/filter.md).

# Filter

Filter the dataset. Supports two types of filters:

1. Comparison filters, which compare the values in a column with a value
2. Advanced filters, which support full SQL strings for custom filtering logic

## Parameters

| Name  | Type         | Description                               | Is Optional |
| ----- | ------------ | ----------------------------------------- | ----------- |
| items | filter\_list | list of dictionaries representing filters |             |

## Example

```python
ds = rasgo.get.dataset(74)

# comma separated list of 'WHERE' clauses
ds2 = ds.filter(items=['PRODUCTKEY < 500'])
ds2.preview()

# full filtering with a column, operator, and comparison value
ds3 = ds.filter(items=[{'column_name':'PRODUCTKEY', 'operator':'>', 'comparison_value':'101'}])
ds3.preview()
```

## Source Code

{% embed url="<https://github.com/rasgointelligence/RasgoTransforms/blob/main/rasgotransforms/rasgotransforms/transforms/filter/filter.sql>" %}
