Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • The statistics module requires python version >= 3.4 Commented Sep 10, 2015 at 13:05
  • @Peter.O you are correct - is that a problem? Commented Sep 10, 2015 at 16:17
  • Its not a problem unless you don't have the appropriate python version. It just make it less portable. Commented Sep 10, 2015 at 22:54
  • 2
    Why do you use int to convert the number. What if the number is float value? Besides, you need to strip the newline from the number in each line. The correct command is: cat data.log | python3 -c "import fileinput as FI,statistics as STAT; i = [float(l.strip()) for l in FI.input()]; print('min:', min(i), ' max: ', max(i), ' avg: ', STAT.mean(i), ' median: ', STAT.median(i))" Commented Jul 13, 2020 at 8:11