我想乘以pandas.core.series.Series 40行和只有一列的整个数据帧大小40行* 600列。所以我的目标是将所有行乘以唯一行。它让我回来一个错误。熊猫:乘以数据帧
operands could not be broadcast together with shapes (23560,) (589,)
[In] df1:
[out]
Index col1
2065-12-20 12 days
2061-10-31 12 days
2045-11-28 70 days
2043-10-31 11 days
2040-07-30 21 days
2049-06-30 64 days
2036-01-31 14 days
[In] df2:
Index col1 col2 etc....
2065-12-20 14 120
2061-10-31 18 800
2045-11-28 19 580
2043-10-31 21 12
2040-07-30 44 21
2049-06-30 1.2 17
2036-01-31 61.8 61
[in] k = df1 * df2
[out] operands could not be broadcast together with shapes (23560,) (589,)
我最终要
Index col1 col2 etc....
2065-12-20 14*12 120*12
2061-10-31 18*12 800*12
2045-11-28 19*70 580*70
2043-10-31 21*11 12*11
2040-07-30 44*21 21*21
2049-06-30 1.2*64 17*64
2036-01-31 61.8*14 61*61
这可能是很基本的,但我与it..is它stugling因为我DF1是天?我怎样才能将它转化为常规数字? 谢谢
什么,我能想到的是提取的第一个DF成串联和这个乘法应用到第二DF。但我不认为它的优雅:( – Bobby
@Bobby仍然不工作,我试图...'操作数不能与形状(23560,)(589,)' – user6457870