I need to rename a column, "DOB" in my spark dataframe to "DateOfBirth" after checking if the column is available in the dataframe or not.
I am doing the below for renaming the column, but how do I insert the condition here
df.withColumnRenamed("DOB","DateOfBirth")
Could anyone please help on this.