def overwrite_novel_deltas(baseline, deltas, dates):
 get_indexes = dates.searchsorted
 novel_idx = ((get_indexes(deltas[TS_FIELD_NAME].values, 'right') - get_indexes(deltas[AD_FIELD_NAME].values, 'left')) <= 1)
 novel_deltas = deltas.loc[novel_idx]
 non_novel_deltas = deltas.loc[(~ novel_idx)]
 cat = pd.concat((baseline, novel_deltas), ignore_index=True, copy=False)
 cat.sort_values(TS_FIELD_NAME, inplace=True)
 return (cat, non_novel_deltas)

def overwrite_novel_deltas ( baseline , deltas , dates ) : get_indexes = dates . searchsorted novel_idx = ( ( get_indexes ( deltas [ TS_FIELD_NAME ] . values , 'right' ) - get_indexes ( deltas [ AD_FIELD_NAME ] . values , 'left' ) ) <= 1 ) novel_deltas = deltas . loc [ novel_idx ] non_novel_deltas = deltas . loc [ ( ~ novel_idx ) ] cat = pd . concat ( ( baseline , novel_deltas ) , ignore_index = True , copy = False ) cat . sort_values ( TS_FIELD_NAME , inplace = True ) return ( cat , non_novel_deltas )
overwrite any deltas into the baseline set that would have changed our most recently known value .