docstr: Applies the specified filters or composite_filters recursively.
  
  :param df: The dataset to apply the filters to.
  :type: pandas.DataFrame
  :param filters: The filters or composite_filters to apply to the
                  dataset.
  :type filters: list[dict]
  :param categorical_features: The categorical feature names.
  :type categorical_features: list[str]
  :param categories: The list of categorical values for the categorical
      features.
  :type categories: list[list]
  :return: The filtered dataset.
  :rtype: pandas.DataFrame
docstr_tok: ["Applies","the","specified","filters","or","composite_filters","recursively",".",":","param","df",":","The","dataset","to","apply","the","filters","to",".",":","type",":","pandas.DataFrame",":","param","filters",":","The","filters","or","composite_filters","to","apply","to","the","dataset",".",":","type","filters",":","list","[","dict","]",":","param","categorical_features",":","The","categorical","feature","names",".",":","type","categorical_features",":","list","[","str","]",":","param","categories",":","The","list","of","categorical","values","for","the","categorical","features",".",":","type","categories",":","list","[","list","]",":","return",":","The","filtered","dataset",".",":","rtype",":","pandas.DataFrame"]
code: def _apply_recursive_filter(
      self, df, filters, categorical_features, categories
  ):
      """Applies the specified filters or composite_filters recursively.
  
      :param df: The dataset to apply the filters to.
      :type: pandas.DataFrame
      :param filters: The filters or composite_filters to apply to the
                      dataset.
      :type filters: list[dict]
      :param categorical_features: The categorical feature names.
      :type categorical_features: list[str]
      :param categories: The list of categorical values for the categorical
          features.
      :type categories: list[list]
      :return: The filtered dataset.
      :rtype: pandas.DataFrame
      """
      if filters:
          return df.query(
              self._build_query(
                  filters, categorical_features, categories
              )
          )
      else:
          return df
  
file_path: responsible-ai-toolbox/erroranalysis/erroranalysis/_internal/cohort_filter.py
imports: from typing import Any, List, Optional
  import numpy
  import pandas
  from erroranalysis._internal.constants import ARG, COLUMN, COMPOSITE_FILTERS, METHOD, OPERATION, PRED_Y, ROW_INDEX, TRUE_Y, CohortFilterMethods, CohortFilterOps, ModelTask
  from erroranalysis._internal.metrics import get_ordered_classes
  from erroranalysis._internal.utils import is_spark
label_desc: Use image node_id 10 for calling the FilterDataWithCohortFilters obj's underlying member method code with example usage: obj._apply_recursive_filter(df, filters, categorical_features, categories) and returns: df, df