I have a dataframe like this . And I have to multiply the 'Factor' column value row wise with another dataframe
I want result like this
I have tried with df.mul. But it is giving me all NAN values. How to get this resultant matrix using python
CodePudding user response:
pd.DataFrame(df2.to_numpy() * df1.to_numpy())
CodePudding user response:
df2.apply(lambda x: x * df1['factor'])