if row is a numpy ``array``, you can just use ``numpy.mean(row, axis=1)``