Teradata Package for Python Function Reference | 17.10 - strip - Teradata Package for Python
Teradata® Package for Python Function Reference
- Product
- Teradata Package for Python
- Release Number
- 17.10
- Published
- April 2022
- Language
- English (United States)
- Last Update
- 2022-08-19
- Product Category
- Teradata Vantage
- teradataml.dataframe.sql.DataFrameColumn.strip = strip(self)
- Remove leading and trailing whitespace.
REFERENCE:
SQL Functions, Operators, Expressions, and Predicates
Chapter 26 String Operators and Functions
RETURNS:
A str Series with leading and trailing whitespace removed
EXAMPLES:
>>> tdf = DataFrame('iris')
>>> species = tdf['Name']
# create a column with some whitespace
>>> wdf = df.assign(drop_columns = True,
species = species,
w_spaces = '\n ' + species + '\v\f \t')
species w_spaces
0 Iris-versicolor \n
Iris-versicolor
\t
1 Iris-versicolor \n
Iris-versicolor
\t
2 Iris-virginica \n
Iris-virginica
\t
3 Iris-versicolor \n
Iris-versicolor
\t
4 Iris-virginica \n
Iris-virginica
\t
5 Iris-versicolor \n
Iris-versicolor
\t
6 Iris-versicolor \n
Iris-versicolor
\t
7 Iris-virginica \n
Iris-virginica
\t
8 Iris-setosa \n
Iris-setosa
\t
9 None None
>>> wdf.assign(drop_columns = True,
wo_wspaces = wdf.w_spaces.str.strip())
wo_wspaces
0 Iris-versicolor
1 Iris-versicolor
2 Iris-virginica
3 Iris-versicolor
4 Iris-virginica
5 Iris-versicolor
6 Iris-versicolor
7 Iris-virginica
8 Iris-setosa
9 None