I've written the following Python/Pandas code to multiply each column of an M row x N col dataframe (A) by an M x 1 dataframe (b) to yield the M x N dataframe C:
def multiply_columns(A, b):
C = pd.DataFrame(A.values * b.values, columns=A.columns, index=b.index)
return C
In other words, it multiplies each column of a matrix by a column vector of equal length.
The code works fine, but I can't recall the formal name for this operation. Thoughts?