substring based Filtering

Teradata® Python Package User Guide

brand
Teradata Vantage
prodname
Teradata Python Package
vrm_release
16.20
category
User Guide
featnum
B700-4006-098K

Example: Filtering with axis set to 'columns' or 1

When axis is 'columns' or 1, then the like substring pattern is applied to the column names of the DataFrame.
The substring pattern is case sensitive.
df.filter(like = 'Length', axis = 'columns')

   SepalLength  PetalLength
0          6.9          5.7
1          7.7          6.9
2          5.7          4.5
3          5.7          4.2
4          6.3          4.9
5          6.8          5.5
6          7.7          6.1
7          4.9          3.3
8          5.5          3.8
9          5.0          1.3

Example: Filtering with axis set to 'rows' or 0

When axis is 'rows' or 0, then the like substring pattern is applied to the values of the columns specified in the index_label of the DataFrame.
The index columns will be cast into VARCHAR columns in order to perform the match.
df.filter(like = 'ic', axis = 'rows')

                 SepalLength  SepalWidth  PetalLength  PetalWidth 
Name                                                                           
Iris-versicolor          5.7         2.8          4.1         1.3       
Iris-virginica           6.9         3.1          5.1         2.3       
Iris-virginica           6.9         3.1          5.4         2.1       
Iris-versicolor          5.5         2.4          3.8         1.1           
Iris-versicolor          4.9         2.4          3.3         1.0           
Iris-versicolor          5.9         3.0          4.2         1.5           
Iris-versicolor          6.0         2.9          4.5         1.5           
Iris-versicolor          6.8         2.8          4.8         1.4           
Iris-virginica           6.9         3.2          5.7         2.3           
Iris-virginica           5.8         2.7          5.1         1.9