import pandas as pd
import numpy as np
index = pd.date_range('1-Jan-2016',periods=12,freq='MS')
a = pd.DataFrame(np.ones((12,5)),index)
b = pd.Series(4.,index)
print a.multiply(b,axis=0)
out: 0 1 2 3 4 2016-01-01 4 4 4 4 4 2016-02-01 4 4 4 4 4 2016-03-01 4 4 4 4 4 2016-04-01 4 4 4 4 4 2016-05-01 4 4 4 4 4 2016-06-01 4 4 4 4 4 2016-07-01 4 4 4 4 4 2016-08-01 4 4 4 4 4 2016-09-01 4 4 4 4 4 2016-10-01 4 4 4 4 4 2016-11-01 4 4 4 4 4 2016-12-01 4 4 4 4 4
print b.multiply(a,axis=0)
out: ValueError: operands could not be broadcast together with shapes (12,) (12,5)
Comment From: gregKiely
INSTALLED VERSIONS
commit: None python: 2.7.10.final.0 python-bits: 64 OS: Windows OS-release: 7 machine: AMD64 processor: Intel64 Family 6 Model 26 Stepping 5, GenuineIntel byteorder: little LC_ALL: None LANG: en_GB
pandas: 0.17.0 nose: 1.3.4 pip: 7.1.2 setuptools: 18.5 Cython: 0.22 numpy: 1.10.1 scipy: 0.14.0 statsmodels: None IPython: 3.2.0 sphinx: 1.3 patsy: 0.3.0 dateutil: 2.4.2 pytz: 2015.7 blosc: None bottleneck: 0.8.0 tables: 3.1.1 numexpr: 2.3.1 matplotlib: 1.4.3 openpyxl: 1.8.5 xlrd: 0.9.3 xlwt: 0.7.5 xlsxwriter: 0.6.7 lxml: 3.4.2 bs4: 4.3.2 html5lib: 0.999 httplib2: None apiclient: None sqlalchemy: 1.0.8 pymysql: None psycopg2: None
Comment From: jreback
This is has never been supported. It could be, but would require a bit of effort. pull-requests are welcome.
In [45]: b.multiply?
Signature: b.multiply(other, level=None, fill_value=None, axis=0)
Docstring:
Multiplication of series and other, element-wise (binary operator `mul`).
Equivalent to ``series * other``, but with support to substitute a fill_value for
missing data in one of the inputs.
Parameters
----------
other: Series or scalar value
fill_value : None or float value, default None (NaN)
Fill missing (NaN) values with this value. If both Series are
missing, the result will be missing
level : int or name
Broadcast across a level, matching Index values on the
passed MultiIndex level
Returns
-------
result : Series
See also
--------
Series.rmul
File: ~/pandas/pandas/core/ops.py
Type: instancemethod
Comment From: mroeschke
Seems there hasn't been much traction or activity to add this feature so closing