Replace All Spacec Column With Underscore In Pandas Code Example

Snippet 1
  import pandas as pd 

# remove spaces in columns name
df.columns = df.columns.str.replace(' ','_')