#Quick and easy, rename the column to replace space with underscore df1.columns = [c.replace(' ', '_') for c in df1.columns]