The strip() method in teradataml package is similar to the strip method of strings in Python. It removes leading and trailing whitespace from string values in a column.
Example Prerequisite
>>> 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: Display without the Strip Method
>>> >>> wdf fn w_spaces 0 None None 1 abcde \n abcde \t 2 abcd \n abcd \t
Example: 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