how to remove whitespace characters in python column code example
Example 1: Python function remove all whitespace from all character columns in dataframe
df.columns = df.columns.str.replace(' ', '')
Example 2: python string remove whitespace
' sss d ssd s'.replace(" ", "")
# output: 'sssdssds'