I have data frame like below
product model ci_low ci_upp
A X 0.041667 48.0
A Y 0.000000 21.0
I want to check if ci_low and ci_upp overlap by product and return something like
product CI Band X CI Band Y Overlap
A [0.041667-48.0] [0.00000 - 21.0] Yes
Note: I have function to check if range overlap, if it return 0 then they dont overlap
def getOverlap(a, b):
return max(0, min(a[1], b[1]) - max(a[0], b[0]))