Reputation: 546
I know this question has been asked several times, but I tried all the anwers and still don't get the right result. I just want to do an element-wise multiplication of two pandas dataframes, but it always results in messing up the structure of the matrix:
x = pd.DataFrame([1,1,1],[2,2,2])
y= pd.DataFrame([0,0,0],[1,1,1])
z= x*y should result in z being
2 0
2 0
2 0
But instead results in z being:
0
1 NaN
1 NaN
1 NaN
2 NaN
2 NaN
2 NaN
What am I doing wrong? I tried pandas.mul and pandas.multiply, but no success.
Upvotes: 0
Views: 1503