I have a file with several lines, each containing some 30,000 integers. I’m interested in computing various statistical quantities such as mean/media/variance/etc., per line.
For example, given a file whose contents are
1 2 3 4 5
6 8 9 0 10 11 12
I would like an output similar to
(std = 1.4142135623730951, mean = 3.0, median = 3.0)
(std = 3.7416573867739413, mean = 8.0, median = 9.0)
What are my options apart from writing the thing myself (acquiring Happiness Through Numerics) ? Are there any one-liners for this?
A bash/python/perl/etc. solution is preferred, as is simplicity.
Not quite a 1-liner, but quite simple (provided you’ve installed numpy).