Python : easy way to do geometric mean in python?
The formula of the gemetric mean is: So you can easily write an algorithm like: import numpy as np def geo_mean(iterable): a = np.array(iterable) return a.prod()**(1.0/len(a)) You do not have to use numpy for that, but it tends to perform operations on arrays faster than Python. See this answer for why. In case the chances … Read more