prune_filters() | FilterManager Method | Teradata Package for Python - prune_filters() - Teradata Package for Python

Teradata® Package for Python User Guide

Deployment
VantageCloud
VantageCore
Edition
VMware
Enterprise
IntelliFlex
Product
Teradata Package for Python
Release Number
20.00
Published
March 2025
ft:locale
en-US
ft:lastEdition
2026-08-13
dita:mapPath
nvi1706202040305.ditamap
dita:ditavalPath
plt1683835213376.ditaval
dita:id
rkb1531260709148
Product Category
Teradata Vantage
Use the prune_filters() method to remove all filters with IDs lower than the specified filter_id and reassigns sequential IDs starting from 1 to the remaining filters.

Required Parameter

filter_id
Specifies the filter ID used as a threshold to prune filters.
  • The remaining filters with filter_id >= specified filter_id will be retained and reassigned new filter_ids starting from 1.
  • The 'filter_id' must exist in the filter artifact's table.

Example: Create a FilterManager, Load Filter Definitions, and Prune Filters with filter_id < 2

>>> from teradataml import load_example_data, DataFrame, FeatureStore, FilterManager
>>> load_example_data('dataframe', 'admissions_train')
>>> df = DataFrame("admissions_train")

Create a Feature Store.

>>> fs = FeatureStore(repo='vfs_v1', data_domain='sales')
Repo vfs_v1 does not exist. Run FeatureStore.setup() to create the repo and setup FeatureStore.

Create a FeatureStore.

>>> fs.setup()

Create an instance of FilterManager and load filter definitions.

>>> fm = FilterManager(repo='vfs_v1', name='stats_filter_manager')
Filter Manager 'stats_filter_manager' does not exist. Run FilterManager.load_filter() to create it.
>>> fm.load_filter(df=df.groupby('stats').count()[['stats']])
True
>>> fm.list_filters()
              stats
filter_id          
3            Novice
2          Beginner
1          Advanced

Prune filters with filter_id < 2, keeping only filters with filter_id >= 2.

>>> fm.prune_filters(2)
True
>>> fm.list_filters()
              stats
filter_id          
2          Novice
1          Beginner