wesm/pandas — Issue #672: DataFrame.mul on vector gives inconsistent results depending on combination of axis and whether argument is boxed
Author: bshanks
Created: 2012-01-24 02:55:33+00:00
State: open

When argument is boxed in a TimeSeries, the 'axis' argument is respected:

In [108]: a = DataFrame(reshape(range(9),(3,3)))

In [109]: a
Out[109]:
0 1 2
0 0 1 2
1 3 4 5
2 6 7 8

In [110]: a.mul(TimeSeries(range(3)))
Out[110]:
0 1 2
0 0 1 4
1 0 4 10
2 0 7 16

In [111]: a.mul(TimeSeries(range(3)), axis='index')
Out[111]:
0 1 2
0 0 0 0
1 3 4 5
2 12 14 16

but when it is unboxed, the axis argument is silently ignored:

In [112]: a.mul(range(3))
Out[112]:
0 1 2
0 0 1 4
1 0 4 10
2 0 7 16

In [113]: a.mul(range(3), axis='index')
Out[113]:
0 1 2
0 0 1 4
1 0 4 10
2 0 7 16