INNER CODE UNIT · Python
mszell/geospatialdatascience · unit11_mobilityindividual/stats_utils.py:59
def pdf(binsize, input, out='no', normalize=True, include_zeros=False, vmin='NA', vmax='NA',start_from='NA', closing_bin=False):
"""
Return the probability density function of "input"
using linear bins of size "binsize"
Input format: one column of numbers
Example:
---------
a, m = 0.5, 1.
data = np.random.pareto(a, 1000) + m
xy = pdf(10.0, data)
"""
# Detect input type:
if input == sys.stdin:
# the data come form standard input
d = [ list_check(map(float,l.split())) for l in sys.stdin ]
# d = [ float(l) for l in sys.stdin if l.strip() ]