Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def getMean(l):
- total = 0
- for v in l:
- if v != "NA":
- total += v
- return total / len(l)
- def replace(l,new,old): # Inserts mean where 'NA' exists
- for v in l:
- i = l.index(v)
- if v == old:
- l.pop(i)
- l.insert(i,new)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement