INNER CODE UNIT · Python
i
mszell/geospatialdatascience · unit11_mobilityindividual/stats_utils.py:99
i = int(d[j] / bin) + 1.0 *segno(d[j])
while True:
cont = 0
average = 0.0
if i>=0: ii = i-1
else: ii = i
# To include the lower end in the previous bin, substitute "<" with "<="
while d[j] < bin*(ii+1):
cont += 1.0
average += 1.0
j += 1
if j == lend: break
if cont > 0 or include_zeros==True:
if normalize == True and i != 0:
hist += [[ bin*(ii)+bin/2.0 , average/(lend*bin) ]]
elif i != 0:
hist += [[ bin*(ii)+bin/2.0 , average/bin ]]