Search code examples
pythondataframesklearn-pandas

How to perform multiplication of a column value row wise with another dataframe?


I have a dataframe like this enter image description here. And I have to multiply the 'Factor' column value row wise with another dataframe enter image description here


I want result like this

enter image description here

I have tried with df.mul. But it is giving me all NAN values. How to get this resultant matrix using python


Solution

  • pd.DataFrame(df2.to_numpy() * df1.to_numpy())