私はあなたが使用することができると思う:
C = A * B
次のソリューションは、mul
である:
C = A.mul(B)
サンプル:A
とB
012のな長さを持つ
print A
a b
0 1 3
1 2 4
2 3 7
print B
a b
0 2 3
1 1 4
2 3 2
print A * B
a b
0 2 9
1 2 16
2 9 14
print A.mul(B)
a b
0 2 9
1 2 16
2 9 14
タイミング 300k:
In [218]: %timeit A * B
The slowest run took 4.27 times longer than the fastest. This could mean that an intermediate result is being cached
100 loops, best of 3: 3.57 ms per loop
In [219]: %timeit A.mul(B)
100 loops, best of 3: 3.56 ms per loop
A = pd.concat([A]*100000).reset_index(drop=True)
B = pd.concat([B]*100000).reset_index(drop=True)
print A * B
print A.mul(B)
Thanks jezrael!私は尋ねる前にこれを試しておくべきだった。 – impossible
問題はありませんが、わかりませんでしたが、答えを書いてサンプルで検証します。 – jezrael
私はタイミングを追加してください、受け入れないでください、upvoteの答えを忘れてください。ありがとう。 – jezrael