remove spaces from pandas column names code example
Example 1: Python function remove all whitespace from all character columns in dataframe
df.columns = df.columns.str.replace(' ', '')
Example 2: removing whitespaces from pandas dataframe csv
df = pd.read_csv('dataframe', sep = '\s*,\s*', engine = 'python')