What is the most idiomatic way to normalize each row of a pandas DataFrame? Normalizing the columns is easy, so one (very ugly!) option is:
(df.T / df.T.sum(
To overcome the broadcasting issue, you can use the div method:
div
df.div(df.sum(axis=1), axis=0)
See http://pandas.pydata.org/pandas-docs/stable/basics.html#matching-broadcasting-behavior