item 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 'rows' or 0

When axis is 'rows' or 0, the function returns those rows with the index column(s) values specified in the items list.

df.filter(items = ['Iris-setosa', 'Iris-versicolor'], axis = 0)

                SepalLength  SepalWidth  PetalLength  PetalWidth
Name                                                             
Iris-versicolor          4.9         2.4          3.3         1.0
Iris-setosa              5.1         3.8          1.5         0.3
Iris-versicolor          5.2         2.7          3.9         1.4
Iris-setosa              5.1         3.5          1.4         0.3
Iris-setosa              4.3         3.0          1.1         0.1
Iris-versicolor          5.9         3.0          4.2         1.5
Iris-setosa              4.4         3.0          1.3         0.2
Iris-versicolor          6.0         2.9          4.5         1.5
Iris-setosa              4.9         3.1          1.5         0.1
Iris-setosa              5.1         3.5          1.4         0.2

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

When axis is 'columns' or 1, the function returns those columns with the column names specified in the items list.

df.filter(items = ['Name', 'SepalLength', 'SepalWidth'])

                 SepalLength  SepalWidth
Name                                    
Iris-virginica           6.9         3.2
Iris-virginica           7.7         2.6
Iris-versicolor          5.7         2.8
Iris-versicolor          5.7         3.0
Iris-versicolor          6.3         2.5
Iris-virginica           6.8         3.0
Iris-virginica           7.7         3.0
Iris-versicolor          4.9         2.4
Iris-versicolor          5.5         2.4
Iris-setosa              5.0         3.5

Supported types for python literals in items

You can specify float, decimal.Decimal, str, bytes, datetime.time, datetime.date, and datetime.datetime python literal types in the items list.