(self, other)
return res_summary
merge current summeries with the other one.
        Parameters
        ----------
        other : QuantileSummaries
            The summaries to be merged
merge current summeries with the other one.
        Parameters
        ----------
        other : QuantileSummaries
            The summaries to be merged
merge current summeries with the other one . Parameters ---------- other : QuantileSummaries The summaries to be merged
def merge(self, other):
        """
        merge current summeries with the other one.
        Parameters
        ----------
        other : QuantileSummaries
            The summaries to be merged
        """
        if other.head_sampled:
            # other._insert_head_buffer()
            other.compress()

        if self.head_sampled:
            # self._insert_head_buffer()
            self.compress()

        if other.count == 0:
            return self

        if self.count == 0:
            return other

        # merge two sorted array
        new_sample = []
        i, j = 0, 0
        while i < len(self.sampled) and j < len(other.sampled):
            if self.sampled[i].value < other.sampled[j].value:
                new_sample.append(self.sampled[i])
                i += 1
            else:
                new_sample.append(other.sampled[j])
                j += 1
        new_sample += self.sampled[i:]
        new_sample += other.sampled[j:]

        res_summary = self.__class__(compress_thres=self.compress_thres,
                                     head_size=self.head_size,
                                     error=self.error,
                                     abnormal_list=self.abnormal_list)
        res_summary.count = self.count + other.count
        res_summary.missing_count = self.missing_count + other.missing_count
        res_summary.sampled = new_sample
        # self.sampled = new_sample
        # self.count += other.count
        # merge_threshold = math.floor(2 * self.error * self.count) - 1
        merge_threshold = 2 * self.error * res_summary.count

        res_summary.sampled = res_summary._compress_immut(merge_threshold)
        return res_summary
def merge ( self , other ) : if other . head_sampled : # other._insert_head_buffer() other . compress ( ) if self . head_sampled : # self._insert_head_buffer() self . compress ( ) if other . count == 0 : return self if self . count == 0 : return other # merge two sorted array new_sample = [ ] i , j = 0 , 0 while i < len ( self . sampled ) and j < len ( other . sampled ) : if self . sampled [ i ] . value < other . sampled [ j ] . value : new_sample . append ( self . sampled [ i ] ) i += 1 else : new_sample . append ( other . sampled [ j ] ) j += 1 new_sample += self . sampled [ i : ] new_sample += other . sampled [ j : ] res_summary = self . __class__ ( compress_thres = self . compress_thres , head_size = self . head_size , error = self . error , abnormal_list = self . abnormal_list ) res_summary . count = self . count + other . count res_summary . missing_count = self . missing_count + other . missing_count res_summary . sampled = new_sample # self.sampled = new_sample # self.count += other.count # merge_threshold = math.floor(2 * self.error * self.count) - 1 merge_threshold = 2 * self . error * res_summary . count res_summary . sampled = res_summary . _compress_immut ( merge_threshold ) return res_summary