> ## Documentation Index
> Fetch the complete documentation index at: https://docs.graphext.com/llms.txt
> Use this file to discover all available pages before exploring further.

# filter_values

> Filter rows where column matches specified values exactly. 

## Usage

The following examples show how the step can be used in a recipe.

<Accordion title="Examples" icon="code" defaultOpen="true">
  <Tabs>
    <Tab title="Example 1">
      To create a new dataset keeping only those rows where values in the "salary" column are either "low" or "high".

      ```stan theme={null}
      filter_values(ds, {"column": "salary", "values": ["low", "high"]}) -> (ds_filtered)
      ```
    </Tab>

    <Tab title="Example 2">
      Or, using the `exclude` parameter to *drop* rows where "salary" values are either "low" or "high":

      ```stan theme={null}
      filter_values(ds, {"column": "salary", "values": ["low", "high"], "exclude": true}) -> (ds_filtered)
      ```
    </Tab>

    <Tab title="Signature">
      General syntax for using the step in a recipe. Shows the inputs and outputs the step is expected to receive and will produce respectively. For futher details see sections below.

      ```stan theme={null}
      filter_values(ds_in: dataset, {
          "param": value,
          ...
      }) -> (ds_out: dataset)
      ```
    </Tab>
  </Tabs>
</Accordion>

## Inputs & Outputs

The following are the inputs expected by the step and the outputs it produces. These are generally
columns (`ds.first_name`), datasets (`ds` or `ds[["first_name", "last_name"]]`) or models (referenced
by name e.g. `"churn-clf"`).

<Accordion title="Inputs" icon="right-to-bracket">
  <ParamField path="ds_in" type="dataset" required>
    An input dataset to filter.
  </ParamField>
</Accordion>

<Accordion title="Outputs" icon="right-from-bracket">
  <ParamField path="ds_out" type="dataset" required>
    A new dataset containing the same columns as the input dataset but only those rows passing the filter condition.
  </ParamField>
</Accordion>

## Configuration

The following parameters can be used to configure the behaviour of the step by including them in
a json object as the last "input" to the step, i.e. `step(..., {"param": "value", ...}) -> (output)`.

<Accordion title="Parameters" defaultOpen="true" icon="sliders">
  <ParamField path="column" type="string (ds_in.column)" required>
    Name of column to be matched against the specified `values`.
  </ParamField>

  <ParamField path="values" type="[number, string, array[['number', 'string']]]" required>
    Only rows matching these values exactly will be included in the resulting dataset.
    May be a single value or a list of values to be matched.

    <Accordion title="Array items">
      <ParamField path="Item" type="[number, string]">
        Each item in array.
      </ParamField>
    </Accordion>

    <Accordion title="Examples">
      * the
      * \['the', 'cat']
      * 2
      * \[2, 3]
    </Accordion>
  </ParamField>

  <ParamField path="exclude" type="boolean" default="false">
    if `true`, only rows *not* matching the specified `values` will be included in the resulting dataset.
  </ParamField>
</Accordion>
