(self, rows)
When getting E(x^n), the formula are:
        .. math::

            (i-1)/i * S_{i-1} + 1/i * x_i

        where i is the current count, and S_i is the current expectation of x
When getting E(x^n), the formula are:
        .. math::
When getting E ( x^n ) the formula are : .. math ::
def add_rows(self, rows):
        """
        When getting E(x^n), the formula are:
        .. math::

            (i-1)/i * S_{i-1} + 1/i * x_i

        where i is the current count, and S_i is the current expectation of x
        """
        if self.abnormal_list is None:
            rows = np.array(rows, dtype=float)
            self.count += 1
            self.sum += rows
            self.sum_square += rows ** 2
            self.max_value = np.max([self.max_value, rows], axis=0)
            self.min_value = np.min([self.min_value, rows], axis=0)
            for m in range(3, self.stat_order + 1):
                exp_sum_m = getattr(self, f"exp_sum_{m}")
                exp_sum_m = (self.count - 1) / self.count * exp_sum_m + rows ** m / self.count
                setattr(self, f"exp_sum_{m}", exp_sum_m)
        else:
            for idx, value in enumerate(rows):
                if value in self.abnormal_list:
                    continue
                try:
                    value = float(value)
                except ValueError as e:
                    raise ValueError(f"In add func, value should be either a numeric input or be listed in "
                                     f"abnormal list. Error info: {e}")
                self.count[idx] += 1
                self.sum[idx] += value
                self.sum_square[idx] += value ** 2
                self.max_value[idx] = np.max([self.max_value[idx], value])
                self.min_value[idx] = np.min([self.min_value[idx], value])
                for m in range(3, self.stat_order + 1):
                    exp_sum_m = getattr(self, f"exp_sum_{m}")
                    exp_sum_m[idx] = (self.count[idx] - 1) / self.count[idx] * \
                                     exp_sum_m[idx] + rows[idx] ** m / self.count[idx]
                    setattr(self, f"exp_sum_{m}", exp_sum_m)
def add_rows ( self , rows ) : if self . abnormal_list is None : rows = np . array ( rows , dtype = float ) self . count += 1 self . sum += rows self . sum_square += rows ** 2 self . max_value = np . max ( [ self . max_value , rows ] , axis = 0 ) self . min_value = np . min ( [ self . min_value , rows ] , axis = 0 ) for m in range ( 3 , self . stat_order + 1 ) : exp_sum_m = getattr ( self , f"exp_sum_{m}" ) exp_sum_m = ( self . count - 1 ) / self . count * exp_sum_m + rows ** m / self . count setattr ( self , f"exp_sum_{m}" , exp_sum_m ) else : for idx , value in enumerate ( rows ) : if value in self . abnormal_list : continue try : value = float ( value ) except ValueError as e : raise ValueError ( f"In add func, value should be either a numeric input or be listed in " f"abnormal list. Error info: {e}" ) self . count [ idx ] += 1 self . sum [ idx ] += value self . sum_square [ idx ] += value ** 2 self . max_value [ idx ] = np . max ( [ self . max_value [ idx ] , value ] ) self . min_value [ idx ] = np . min ( [ self . min_value [ idx ] , value ] ) for m in range ( 3 , self . stat_order + 1 ) : exp_sum_m = getattr ( self , f"exp_sum_{m}" ) exp_sum_m [ idx ] = ( self . count [ idx ] - 1 ) / self . count [ idx ] * exp_sum_m [ idx ] + rows [ idx ] ** m / self . count [ idx ] setattr ( self , f"exp_sum_{m}" , exp_sum_m )