calculates the percentiles of col_name 
        WHERE [where_col_list] = [where_value_list]
185697
def calc_percentiles(self, col_name, where_col_list, where_value_list):
        
        #col_data = self.get_col_data_by_name(col_name)
        col_data = self.select_where(where_col_list, where_value_list, col_name)
        #print('calc_percentiles: col_data = ', col_data, ' where_col_list = ', where_col_list, ', where_value_list = ', where_value_list)
        if len(col_data) == 0:
            #print("Nothing to calculate")
            return 0,0,0
        else:
            first  = self.percentile(col_data, .25)
            third  = self.percentile(col_data, .75)
            median = self.percentile(col_data, .50)
            #print('CALC_PERCENTILES =  first, third, median ',  first, third, median )
            return  first, third, median
249437
def colum_avg(self, state):
        """"""
        self.colum_avg_enabled = state > 0
        if self.colum_avg_enabled:
            self.return_max = lambda col_vals, index: col_vals[index]
        else:
            self.return_max = global_max
        self.reset()
403716
public function aggregate($function, $columns = array('*'), $percentile = null) {
        $this->aggregate = array_merge([
            'label' => $this->from
                ], compact('function', 'columns', 'percentile'));

        $previousColumns = $this->columns;

        $results = $this->get($columns);


        // Once we have executed the query, we will reset the aggregate property so
        // that more select queries can be executed against the database without
        // the aggregate value getting in the way when the grammar builds it.
        $this->aggregate = null;

        $this->columns = $previousColumns;

        if ($results->valid()) {
            $data = $results->getData();
            if (isset($data)) {
                $result = array_change_key_case((array) $data[0]);

                return isset($result['aggregate']) ? $result['aggregate'] : 1;
            }

            return $results->current()[0];
        }
    }
811594
def percentile(values, k):
    
    if not values:
        return None
    values.sort()
    index = (len(values) * (float(k) / 100)) - 1
    return values[int(math.ceil(index))]
341692
function determineDeltas(sizes, column, step, min, isPercentageBased) {

        var result = sizes.slice(0);

        function generateZeros(array) {
          return Tools.map(array, function () {
            return 0;
          });
        }

        function onOneColumn() {
          var deltas;
          if (isPercentageBased) {
            // If we have one column in a percent based table, that column should be 100% of the width of the table.
            deltas = [100 - result[0]];
          } else {
            var newNext = Math.max(min, result[0] + step);
            deltas = [newNext - result[0]];
          }
          return deltas;
        }

        function onLeftOrMiddle(index, next) {

          var startZeros = generateZeros(result.slice(0, index));
          var endZeros = generateZeros(result.slice(next + 1));
          var deltas;

          if (step >= 0) {
            var newNext = Math.max(min, result[next] - step);
            deltas = startZeros.concat([step, newNext - result[next]]).concat(endZeros);
          } else {
            var newThis = Math.max(min, result[index] + step);
            var diffx = result[index] - newThis;
            deltas = startZeros.concat([newThis - result[index], diffx]).concat(endZeros);
          }

          return deltas;
        }

        function onRight(previous, index) {
          var startZeros = generateZeros(result.slice(0, index));
          var deltas;

          if (step >= 0) {
            deltas = startZeros.concat([step]);
          } else {
            var size = Math.max(min, result[index] + step);
            deltas = startZeros.concat([size - result[index]]);
          }

          return deltas;

        }

        var deltas;

        if (sizes.length === 0) { // No Columns
          deltas = [];
        } else if (sizes.length === 1) { // One Column
          deltas = onOneColumn();
        } else if (column === 0) { // Left Column
          deltas = onLeftOrMiddle(0, 1);
        } else if (column > 0 && column < sizes.length - 1) { // Middle Column
          deltas = onLeftOrMiddle(column, column + 1);
        } else if (column === sizes.length - 1) { // Right Column
          deltas = onRight(column - 1, column);
        } else {
          deltas = [];
        }

        return deltas;
      }
408901
def column_lists_equal(a: List[Column], b: List[Column]) -> bool:
    
    n = len(a)
    if len(b) != n:
        return False
    for i in range(n):
        if not columns_equal(a[i], b[i]):
            log.debug("Mismatch: {!r} != {!r}", a[i], b[i])
            return False
    return True
1187759
def percentile(self, percentile):
        """"""
        percentile = float(percentile)
        if percentile != percentile or percentile < 0 or percentile > 100:
            raise ValueError('Expected a 0 <= percentile <= 100')
        result = c_float()
        if not Gauged.map_percentile(self.ptr, percentile, byref(result)):
            raise MemoryError
        return result.value
616870
private int selectRightToLeft( int col , int[] scores ) {
		// see how far it can search
		int localMax = Math.min(imageWidth-regionWidth,col+maxDisparity)-col-minDisparity;

		int indexBest = 0;
		int indexScore = col;
		int scoreBest = scores[col];
		indexScore += imageWidth+1;

		for( int i = 1; i < localMax; i++ ,indexScore += imageWidth+1) {
			int s = scores[indexScore];

			if( s < scoreBest ) {
				scoreBest = s;
				indexBest = i;
			}
		}

		return indexBest;
	}
946493
def update_where(self, col, value, where_col_list, where_value_list):
        
        if type(col) is str:
            col_ndx = self.get_col_by_name(col)
        else:
            col_ndx = col
        #print('col_ndx = ', col_ndx    )
        #print("updating " + col + " to " , value, " where " , where_col_list , " = " , where_value_list)
        new_arr = self.select_where(where_col_list, where_value_list)
        #print('new_arr', new_arr)
        for r in new_arr:
            self.arr[r[0]][col_ndx] = value
304124
def select(self, columns=(), by=(), where=(), **kwds):
        
        return self._seu('select', columns, by, where, kwds)
193453
def perc(arr, p=95, **kwargs):
    """"""
    offset = (100 - p) / 2
    return np.percentile(arr, (offset, 100 - offset), **kwargs)
782862
def check_columns(column, line, columns):
    
    return column <= min(len(line), max(columns))
164777
def itake_column(list_, colx):
    
    if isinstance(colx, list):
        # multi select
        return ([row[colx_] for colx_ in colx] for row in list_)
    else:
        return (row[colx] for row in list_)
186152
def values(self, column_name, exclude_type=STRUCT):
        
        column_name = unnest_path(column_name)
        columns = self.columns
        output = []
        for path in self.query_path:
            full_path = untype_path(concat_field(path, column_name))
            for c in columns:
                if c.jx_type in exclude_type:
                    continue
                # if c.cardinality == 0:
                #     continue
                if untype_path(c.name) == full_path:
                    output.append(c)
            if output:
                return output
        return []
1143894
def exact(self, column, *values):
        
        df = self._exact(column, *values)
        if df is None:
            self.err("Can not select exact data")
        self.df = df
678394
def select_where(self, where_col_list, where_value_list, col_name=''):
        
        res = []        # list of rows to be returned
        col_ids = []    # ids of the columns to check
        #print('select_where  : arr = ',  len(self.arr), 'where_value_list = ',  where_value_list)
        for col_id, col in enumerate(self.header):
            if col in where_col_list:
                col_ids.append([col_id, col])
        #print('select_where    : col_ids = ',  col_ids)   # correctly prints [[0, 'TERM'], [2, 'ID']]
        
        for row_num, row in enumerate(self.arr):
            keep_this_row = True
            #print('col_ids=', col_ids, ' row = ', row_num, row)
            for ndx, where_col in enumerate(col_ids):
                #print('type where_value_list[ndx] = ', type(where_value_list[ndx]))
                #print('type row[where_col[0]] = ', type(row[where_col[0]]))
                
                if row[where_col[0]] != where_value_list[ndx]:
                    keep_this_row = False
            if keep_this_row is True:
                if col_name == '':
                    res.append([row_num, row])
                else:   # extracting a single column only
                    l_dat = self.get_col_by_name(col_name)
                    if l_dat is not None:
                        res.append(row[l_dat])
        return res
421313
def _percent_match(date_classes, tokens):
    
    match_count = [0] * len(date_classes)

    for i, date_class in enumerate(date_classes):
        for token in tokens:
            if date_class.is_match(token):
                match_count[i] += 1

    percentages = tuple([float(m) / len(tokens) for m in match_count])
    return percentages