File size: 378 Bytes
53a6def | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | import numpy as np
def calc_ds_med(v):
"""
Calculate the median value of a subgroup by removing any float nulls and
converting from days to integers
--------
:param v: values in column
:return: median value
"""
day = np.timedelta64(1, 'D')
med_val = (v.dropna() / day).astype(int).median().astype(int)
med_val *= day
return med_val |