I have a requirement to change column name of a dataframe df
with respect to other dataframe df_col
using pyspark
df
+----+---+----+----+
|code| id|name|work|
+----+---+----+----+
| ASD|101|John| DEV|
| klj|102| ben|prod|
+----+---+----+----+
df_col
+-----------+-----------+
|col_current|col_updated|
+-----------+-----------+
| id| Row_id|
| name| Name|
| code| Row_code|
| Work| Work_Code|
+-----------+-----------+
if df column matches col_current, df column should replace with col_updated. ex: if df.id matches df.col_current, df.id should replace with Row_id.
expected output
Row_id,Name,Row_code,Work_code
101,John,ASD,DEV
102,ben,klj,prod
Note: I want this process to be dynamic.