The sample of the dataset I am working on:
test = sqlContext.createDataFrame([(1,2),
(1,3),
(4,5)],
['cod_item_2','alter_cod'])
test_2 = sqlContext.createDataFrame([(1,"shamp_1"),(2,"shamp_2"),
(4,"tire_1"),(5,"tire_2"),
(3,"shamp_3"),(6,"cookie"),
(7,"flower"),(8,"water")],
['cod_item','product_name'])
The first dataframe contains items and items that are equivalent to them.
The second dataframe contains all items and product names.
I want to use the first dataframe to pull out the items that are equivalent to the second dataframe and replace with the item that represents them (the item on the left side of the first table), where the result is as follows:
I tried doing a full join on both dataframes and using the when clause to change the values. But it ended up not working.


