[Tutor] Problem understanding the asarray function of numpy

Emile van Sebille emile at fenx.com
Thu Sep 11 18:26:24 CEST 2014


On 9/11/2014 6:34 AM, Radhika Gaonkar wrote:
> I have an implementation of lsa, that I need to modify. I am having some
> trouble understanding the code. This is the line where I am stuck:
>
> DocsPerWord = sum(asarray(self.A > 0, 'i'), axis=1)

Python doesn't provide an axis parameter for the sum builtin -- this sum 
function comes from numpy.  See 
http://docs.scipy.org/doc/numpy/reference/generated/numpy.sum.html for 
details.

Emile



More information about the Tutor mailing list