Nilai trim Python Pandas di DataFrame

# Trim all whitespaces in dataframe
df = df.replace(r'\s*(.*?)\s*', r'\1', regex=True)

# Trim all whitespaces in a column or series
df = df["column"].str.strip()
Kwams