substring based Filtering | Teradata Python Package - 17.00 - substring based Filtering - Teradata Package for Python

Teradata® Package for Python User Guide

Product
Teradata Package for Python
Release Number
17.00
Release Date
November 2021
Content Type
User Guide
Publication ID
B700-4006-070K
Language
English (United States)

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