0
votes

I want to know if a a spark data frame can have two different names to a column.

I knew that by using "withColumn" i can add a new column but i do not want to add a new column to the data frame, but i just want to have alias name to the existing column in a data frame.

Example If there is a data frame with 3 columns "Col1, Col2, Col3".

So can anyone please let me know if i can give a alias name to Col3 so that i can retrieve the data of 'Col3' with name "Col4" as well.

1
Why? This feels like it may be an X/Y scenario mywiki.wooledge.org/XyProblem - David

1 Answers

0
votes

EDIT: possible duplicate: Usage of spark DataFrame "as" method

It looks like there are several ways depending on the spark library and client library you're using.