def quantile_bins(quantiles, min = 0, max = 100):
"""Return a list of quantiles including floor and ceiling values
Args:
quantile (list): Quantile values in order
min (numeric): Floor value of data range
max (numeric): Ceiling value of data range
Returns:
list: An inclusive list of quantile bin values
Examples:
>>> quantile_bins([13.18221923304911, 15.913682562603704, 23.990235841052815, 44.71041388741459])
[0, 13.18221923304911, 15.913682562603704, 23.990235841052815, 44.71041388741459, 100]
"""
#######################
## INPUT VALUE TESTS ##
#######################
if not isinstance(min, (int, float)):
raise TypeError("Value should be an integer or float.")
if not isinstance(max, (int, float)):
raise TypeError("Value should be an integer or float.")
if not isinstance(quantiles, list):
raise TypeError("The quantiles should be passed as a list.")
######################
## FUNCTION PROCESS ##
######################
return [min] + quantiles + [max]