Solved

Different error messages for pass 2 and pass 3

CharlieHOP

Pass 2 says "stdev requires at least two data points", pass 3 says "mean requires at least one". Why different?

5

Comments 4

Log in to join the discussion.

Log in Create account
  1. JackStack Solutionreplies: 2

    Pass 3 is empty, so mean() fails first. Pass 2 has one reading — mean and median work, but standard deviation needs at least two values. The message tells you which function failed first, and printing str(error) gives you exactly the expected text.

    9
    1. CharlieHOPreplies: 1

      Makes sense, the first failing call decides the message.

      3
      1. EmmaCodes

        Didn't know there were two. Good to know.

        0
    2. AmeliaRuns

      stdev is sample standard deviation; pstdev is population. For sensor readings, stdev is the usual choice.

      2