substring based Filtering - Teradata Python Package

Teradata® Python Package User Guide

Product
Teradata Python Package
Release Number
16.20
Published
February 2020
Language
English (United States)
Last Update
2020-02-29
dita:mapPath
rkb1531260709148.ditamap
dita:ditavalPath
Generic_no_ie_no_tempfilter.ditaval
dita:id
B700-4006
lifecycle
previous
Product Category
Teradata Vantage

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 = '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: 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