Skip to content
Advertisement

Tag: overlap

FAST: 1D overlaps with rows in 2D?

let say i have 2D array, f.e.: I want to calculate overlap with 1D vector, FAST. I can almost do it with (8ms on big array): The problem with it is that it only matches if both Position and Value match. F.e. 5 in 2nd column of 1d vec did not match with 5 in 3rd column on the 2nd

Sum value between overlapping interval slices per group

I have a pyspark dataframe as below: And I want to sum only consumption on overlapping interval slices per idx: Answer You can use sequence to expand the intervals into single days, explode the list of days and then sum the consumption for each timestamp and idx: Output: Remarks: sequence includes the last value of the interval, so one day

Advertisement