compute mean in python for a generator

后端 未结 10 2181
遇见更好的自我
遇见更好的自我 2021-01-01 21:58

I\'m doing some statistics work, I have a (large) collection of random numbers to compute the mean of, I\'d like to work with generators, because I just need to compute the

10条回答
  •  孤街浪徒
    2021-01-01 22:56

    One way would be

    numpy.fromiter(Y, int).mean()
    

    but this actually temporarily stores the numbers.

提交回复
热议问题