I have a list of which I want to know the mean value. I found online that the mean() function of the statistics package is designed to be precise ( Why is statistics.mean() so slow?) However, I find it rather inprecise, rounding my means.
example, a list (agent.rr) that of length 100 that contains 5 nonzero inputs: -200, -200, -200, -200 and -240.
if I calcualte:
statistics.mean(agent.rr)
I get the output
-10
If i calculate:
mean(agent.rr)/len(agent.rr)
I get the correct output
-10.4
Why does statistics.mean() not provide the correct answer?
I tried to make some random examples, like:
mylist = [1,2,2]
But statistics.mean() does seem to provide the correct answer whenever I just manually try some lists, but whenever I call it on the list agent.rr it always rounds.