I have a dataframe df_one, df_two like below:
df_one.show()
-------------
|Column_Name|
-------------
|NAME |
|ID |
|COUNTRY |
-------------
df_two.show()
-------------
|_c0|_c1|_c2|
-------------
|AAA|001|US |
|BBB|002|UK |
|CCC|003|IN |
|DDD|004|FR |
-------------
I am trying to rename the column of dataframe df_two like below:
------------- ----
|NAME|ID |COUNTRY|
------------------
|AAA |001| US |
|BBB |002| UK |
|CCC |003| IN |
|DDD |004| FR |
------------------
for time being i created seq and getting the above result
val newColumn = Seq("NAME", "ID", "COUNTRY")
val df = df_two.toDF(newColumn:_*)
But now I have to read column(Column_Name) from df_one and rename the column name of dataframe df_two respectively.
I also tried to read the column value from df_one but its returning Seq[Any] and i need Seq[String] .
guide me with some code here ..