strip() Method | Teradata Package for Python - strip() Method - Teradata VantageCloud Lake

Lake - Analyze Your Data with ClearScape Analytics™

Deployment
VantageCloud
Edition
Lake
Product
Teradata VantageCloud Lake
Release Number
Published
February 2025
ft:locale
en-US
ft:lastEdition
2026-02-20
dita:mapPath
tcl1683670667798.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
tcl1683670667798

Use the strip() method to remove leading and trailing whitespace from string values in a column.

Example Setup

>>> df = DataFrame('employee_info')
>>> df
            first_name marks   dob joined_date
employee_no                                  
101              abcde  None  None    02/12/05
112               None  None  None    18/12/05
100               abcd  None  None        None
>>> fn = df.first_name
# create a column with some whitespace
>>> wdf = df.assign(drop_columns = True, fn = fn, w_spaces = '\n ' + fn + '\v\f \t')

Example 1: Display without the Strip Method

>>> >>> wdf
      fn       w_spaces
0   None           None
1  abcde  \n abcde
 
                   \t
2   abcd   \n abcd
 
                   \t

Example 2: Display with the Strip Method

>>> wdf.assign(drop_columns = True, wo_wspaces = wdf.w_spaces.str.strip())
  wo_wspaces
0       None
1      abcde
2       abcd