'Multiply a column of a data frame into every column of a different data frame

I am trying to multiply a single-column data-frame into every column of another data-frame. both have 40 rows. The idea is that the single column has calculated weights which I want to apply to the returns given in the other data frame

Here are all the ones I tried but I keep getting NaN values.

#lineaInter5m= li_wg * stocks5m
#lineaInter5m = stocks5m.mul(li_wg);
#print(li_wg.multiply(stocks5m))
#li_wg["li_wg"] * stocks5m


Solution 1:[1]

You need to set the axis parameter to "index" or 0

lineaInter5m = stocks5m.mul(li_wg, axis=0)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1