Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Menu
Open sidebar
NTPsec
ntpsec
Commits
d734d4a8
Commit
d734d4a8
authored
Oct 05, 2016
by
Gary E. Miller
💬
Browse files
ntpviz: return 0 as variance of zero or one data items.
No need to crash on empty input.
parent
2e0e5cee
Changes
1
Hide whitespace changes
Inline
Side-by-side
ntpstats/ntpviz
View file @
d734d4a8
...
...
@@ -57,7 +57,8 @@ def pstdev(data, mu=None):
"""
Calculates
the
population
standard
deviation.
"""
n =
len(data)
if
n
<
2
:
raise
ValueError
('
variance
requires
at
least
two
data
points
')
#
variance
requires
at
least
two
data
points
return
0
ss =
_ss(data,
mu
)
pvar =
ss/n
#
the
population
variance
return
pvar**0.5
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment