What is the difference between:
my_df = my_df.select(col('age').alias('age2'))
my_df = my_df.select(col('age').withColumnRenamed('age', 'age2'))
The second expression is not going to work, you need to call
withColumnRenamed() on your
I assume you mean:
my_df = my_df.withColumnRenamed('age', 'age2')
And to answer your question, there is no difference.