remove a column from a dataframe spark
Try this:
val initialDf = ...
val dfAfterDropCols = initialDf.drop("column1", "coumn2")
Use drop method and withColumnRenamed methods.
Example:
val initialDf= ....
val dfAfterDrop=initialDf.drop("column1").drop("coumn2")
val dfAfterColRename= dfAfterDrop.withColumnRenamed("oldColumnName","new ColumnName")