Pandas menghapus ruang
df.columns = df.columns.str.replace(' ', '')
Annoying Alligator
df.columns = df.columns.str.replace(' ', '')
df.columns = df.columns.str.rstrip()
df.columns = df.columns.str.strip()
df.columns = df.columns.str.lstrip()
' 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')