Rename columns x1 to x3, x2 to x4
from pyspark.sql import SparkSession
spark=SparkSession.builder.appName('rename columns').getOrCreate()
data = spark.createDataFrame([(1,2), (3,4)], ['x1', 'x2'])
data.show()
data = data.withColumnRenamed('x1','x3') \
.withColumnRenamed('x2', 'x4')
data.show()