substring based Filtering | Teradata Python Package - substring based Filtering - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
ft:locale
en-US
ft:lastEdition
2024-12-11
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905

Example 1: 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 = 'st', axis = 'columns')
  masters     stats
0     yes  Advanced
1     yes    Novice
2     yes    Novice
3      no  Advanced
4      no  Advanced
5     yes  Advanced
6     yes  Advanced
7      no    Novice
8     yes  Advanced
9     yes    Novice

Example 2: 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 = 'vice', axis = 'rows')
             id masters   gpa     stats admitted
programming                                    
Novice       23     yes  3.59  Advanced        1
Novice       37      no  3.52    Novice        1
Novice       12      no  3.65    Novice        1
Novice       13      no  4.00  Advanced        1
Novice        5      no  3.44    Novice        0
Novice       24      no  1.87  Advanced        1
Novice       33      no  3.55    Novice        1
Novice        7     yes  2.33    Novice        1
Novice       30     yes  3.79  Advanced        0
Novice       36      no  3.00  Advanced        0