I am new to pySpark. I have received a csv file which has around 1000 columns. I am using databricks. Most of these columns have spaces in between eg "Total Revenue" ,"Total Age" etc. I need to updates all the column names with space with underscore'_'.
I have tried this
foreach(DataColumn c in cloned.Columns)
c.ColumnName = String.Join("_", c.ColumnName.Split());
but it didn't work in Pyspark on databricks.