I use Spark 1.5.
I'm struggling with columns which contain dots in their name (e.g. param.x.y) . I first had the issue of selecting them, but then I read that I need to use ` character (`param.x.y`).
Now I'm having issue when trying to rename the columns. I'm using similar approach, but it seems that it doesn't work:
df.withColumnRenamed("`param.x.y`", "param_x_y")
So I wanted to check - is this really a bug, or am I doing something wrong?
Looks like in your code, the problem is with `` in original column name. I just removed it and it worked for me. Sample working code to rename Column name within the dataframe.
Its output:
For more information you can check spark dataframe documentation
Update: I just tested with the quoted string and got the expected output. Please see the code and its output below.
Its output: