Fungsi Python Hapus semua whitespace dari semua kolom karakter di DataFrame
df.columns = df.columns.str.replace(' ', '')
Annoying Alligator
df.columns = df.columns.str.replace(' ', '')
' hello world! '.strip()
'hello world!'
' hello world! '.lstrip()
'hello world! '
' hello world! '.rstrip()
' hello world!'
df = pd.read_csv('dataframe', sep = '\s*,\s*', engine = 'python')