projects
/
swc-testing-nose.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d771983
)
fix mean_sightings
author
shreddd
<shreyas@gmail.com>
Wed, 3 Jul 2013 09:21:19 +0000
(21:21 +1200)
committer
W. Trevor King
<wking@tremily.us>
Fri, 8 Nov 2013 16:59:06 +0000
(08:59 -0800)
python/mean_sightings-full.py
patch
|
blob
|
history
diff --git
a/python/mean_sightings-full.py
b/python/mean_sightings-full.py
index a76c416ce756e5caf34e3dbc00acf95c46a91004..55c51484b571ae52d4f61f6bf0891b88017d0e24 100755
(executable)
--- a/
python/mean_sightings-full.py
+++ b/
python/mean_sightings-full.py
@@
-40,14
+40,17
@@
def get_sightings_loop(filename, focusanimal):
focusanimal = focusanimal.capitalize()
# Loop through all records, countings recs and animals
- totalrecs = 0
- totalcount = 0
+ totalrecs = 0
.
+ totalcount = 0
.
for rec in tab:
if rec['animal'] == focusanimal:
totalrecs += 1
totalcount += rec['count']
- meancount = totalcount/totalrecs
+ if totalrecs==0:
+ meancount = 0
+ else:
+ meancount = totalcount/totalrecs
# Return num of records and animals seen
return totalrecs, meancount