INNER CODE UNIT · Python
standard_dev
mszell/geospatialdatascience · unit11_mobilityindividual/stats_utils.py:36
def standard_dev(list):
ll = len(list)
m = 1.0 * sum(list)/ll
return ( sum([(elem-m)**2.0 for elem in list]) / ll )**0.5
def list_check(lista):
"""
If a list has only one element, return that element. Otherwise return the whole list.
"""
try:
e2 = lista[1]
return lista
except IndexError:
return lista[0]
#______________________________________#