Skip to content
Advertisement

how to do multiplication of two pyspark dataframe row wise

I have below 2 pyspark dataframe df1 and df2 :

JavaScript

I want to multiply df1 each row with the same column of df2 row. Final output be like

JavaScript

Advertisement

Answer

You can do a cross join and multiply the columns using a list comprehension:

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement