You can try klongpy, a K-like array language implementation that runs atop numpy: https://pypi.org/project/klongpy/
(Copied from some forum, since I don't use Python much)
import numpy as np
def geo_mean_overflow(iterable):
return
np.exp(np.log(iterable).mean())
Or, from statistics import.
geometric_mean
geometric_mean([1.0, 0.00001, 10000000000.]) # 46.415888336127786
In J, since I don't know K: gm=:#%:*/
Even shorter than Python whether it's a canned lib routine or created from composing simple functions.And I don't need to format code on HN in J because it's so short anyway, besides I don't know how!
I’m not saying they were right or better. Horses of courses. Array languages do my head in and my choice is sql.
A brilliant programmer I met who came from DE Shaw said he reimplemented a K-based portfolio optimization pipeline because the performance hit a wall once the dataset got large enough. He was able to beat K with Java of all things.
Columnar and timeseries dbs have continued to evolve, K is the same tech it was in the 2000s. The only reason it gets used at a Millennium is that whatever trade is still printing money, not any tech advantage.