That code is exactly the same, so I want to refactor it in a simple way to reduce the number of lines. One thing which is different is min/max function execution. Is it available pointer to function in python to call min/max as a pointer to function like in C?
def calculate_min(a, b, c, d, e, f):
    try:
        v = a[e][f]
        b[d] = v if np.isnan(b[d]) else min(b[d], v)    #min()
    except KeyError as exc:
        logger.error("keyerror")
def calculate_max(a, b, c, d, e, f):
    try:
        v = a[e][f]
        b[d] = v if np.isnan(b[d]) else max(b[d], v)    #max()
    except KeyError as exc:
        logger.error("keyerror")
 
     
     
    