Equivalent to `series.rank(method='dense', ascending=ascending)`.

    Args:
        series: column to rank.

    Kwargs:
        ascending (bool): whether to rank in ascending order (default is `True`).
186056
def dense_rank(series, ascending=True):
    

    ranks = series.rank(method='dense', ascending=ascending)
    return ranks
1036244
def sort_values(self, ascending=False):
        
        if self.index_type is not None:
            index_expr = grizzly_impl.get_field(self.expr, 0)
            column_expr = grizzly_impl.get_field(self.expr, 1)
            zip_expr = grizzly_impl.zip_columns([index_expr, column_expr])
            result_expr = grizzly_impl.sort(zip_expr, 1, self.weld_type, ascending)
            unzip_expr = grizzly_impl.unzip_columns(
                result_expr,
                [self.index_type, self.weld_type]
            )
            return SeriesWeld(
                unzip_expr,
                self.weld_type,
                self.df,
                self.column_name,
                self.index_type,
                self.index_name
            )
        else:
            result_expr = grizzly_impl.sort(self.expr)
839936
def sort_index(self):
        
        sort = sorted_list_indexes(self._index)
        # sort index
        self._index = blist([self._index[x] for x in sort]) if self._blist else [self._index[x] for x in sort]
        # each column
        for c in range(len(self._data)):
            self._data[c] = blist([self._data[c][i] for i in sort]) if self._blist else [self._data[c][i] for i in sort]
763211
def true_range(arg, high_col='high', low_col='low', close_col='close', skipna=0):
    
    _ensure_col(arg, high_col=high_col, low_col=low_col, close_col=close_col)
    yclose = arg[close_col].shift(1)
    low, high = arg[low_col], arg[high_col]
    mx = pd.DataFrame({'a': high, 'b': yclose}).max(axis=1, skipna=skipna)
    mn = pd.DataFrame({'a': low, 'b': yclose}).min(axis=1, skipna=skipna)
    result = mx - mn
    return pd.Series(result, index=arg.index, name='true_range')
303137
def rank(self, n, mu, sigma, crit=.5, upper=10000, xtol=1):
        

        return _make_rank(self, n, mu, sigma, crit=crit, upper=upper,
                                                                    xtol=xtol)
19697
def series_index(self, series):
        
        for idx, s in enumerate(self):
            if series is s:
                return idx
        raise ValueError('series not in chart data object')
227328
def from_pandas(cls, series):
        
        from pandas import Index as PandasIndex, MultiIndex as PandasMultiIndex

        if isinstance(series.index, PandasIndex):
            baloo_index = Index.from_pandas(series.index)
        elif isinstance(series.index, PandasMultiIndex):
            baloo_index = MultiIndex.from_pandas(series.index)
        else:
            raise TypeError('Cannot convert pandas index of type={} to baloo'.format(type(series.index)))

        return _series_from_pandas(series, baloo_index)
726235
def sort(self, cmp=None, key=None, reverse=False):
        
        self._col_list.sort(cmp, key, reverse)
616934
def get_value(self, series, key):
        
        if not is_scalar(key):
            raise InvalidIndexError

        k = com.values_from_object(key)
        loc = self.get_loc(k)
        new_values = com.values_from_object(series)[loc]

        return new_values
381483
def headerSortDescending( self ):
        
        self.setSortingEnabled(True)
        self.sortByColumn(self._headerIndex, QtCore.Qt.DescendingOrder)
330277
def rank(self):
        
        rank = ctypes.c_int()
        check_call(_LIB.MXKVStoreGetRank(self.handle, ctypes.byref(rank)))
        return rank.value
1231844
def mean(series):
    

    if np.issubdtype(series.dtype, np.number):
        return series.mean()
    else:
        return np.nan
664430
def sort(self, column_name=None, reverse=False):
        
        if not column_name and self.options.has_key('sorted_by'):
            column_name = self.options['sorted_by'].keys()[0]
        if column_name not in self.default_columns:
            raise ValueError("%s isn't a column in this table" % column_name)
        index = self.default_columns.index(column_name)
        self.table.sort(key = lambda row: row[index], reverse=reverse)
        self.options['sorted_by'] = {column_name: {'reverse': reverse}}
1233679
function () {
		var series = this,
			options = series.options,
			yAxis = series.yAxis,
			len,
			i,
			points,
			point,
			shapeArgs,
			stack,
			y,
			yValue,
			previousY,
			previousIntermediate,
			range,
			threshold = options.threshold,
			stacking = options.stacking,
			tooltipY;

		// run column series translate
		seriesTypes.column.prototype.translate.apply(this);

		previousY = previousIntermediate = threshold;
		points = series.points;

		for (i = 0, len = points.length; i < len; i++) {
			// cache current point object
			point = points[i];
			yValue = this.processedYData[i];
			shapeArgs = point.shapeArgs;

			// get current stack
			stack = stacking && yAxis.stacks[(series.negStacks && yValue < threshold ? '-' : '') + series.stackKey];
			range = stack ? 
				stack[point.x].points[series.index + ',' + i] :
				[0, yValue];

			// override point value for sums
			// #3710 Update point does not propagate to sum
			if (point.isSum) {
				point.y = yValue;
			} else if (point.isIntermediateSum) {
				point.y = yValue - previousIntermediate; // #3840
			}
			// up points
			y = mathMax(previousY, previousY + point.y) + range[0];
			shapeArgs.y = yAxis.translate(y, 0, 1);


			// sum points
			if (point.isSum) {
				shapeArgs.y = yAxis.translate(range[1], 0, 1);
				shapeArgs.height = yAxis.translate(range[0], 0, 1) - shapeArgs.y;

			} else if (point.isIntermediateSum) {
				shapeArgs.y = yAxis.translate(range[1], 0, 1);
				shapeArgs.height = yAxis.translate(previousIntermediate, 0, 1) - shapeArgs.y;
				previousIntermediate = range[1];

			// If it's not the sum point, update previous stack end position and get 
			// shape height (#3886)
			} else {
				if (previousY !== 0) { // Not the first point
					shapeArgs.height = yValue > 0 ? 
						yAxis.translate(previousY, 0, 1) - shapeArgs.y :
						yAxis.translate(previousY, 0, 1) - yAxis.translate(previousY - yValue, 0, 1);
				}
				previousY += yValue;
			}
			// #3952 Negative sum or intermediate sum not rendered correctly
			if (shapeArgs.height < 0) {
				shapeArgs.y += shapeArgs.height;
				shapeArgs.height *= -1;
			}

			point.plotY = shapeArgs.y = mathRound(shapeArgs.y) - (series.borderWidth % 2) / 2;
			shapeArgs.height = mathMax(mathRound(shapeArgs.height), 0.001); // #3151
			point.yBottom = shapeArgs.y + shapeArgs.height;

			// Correct tooltip placement (#3014)
			tooltipY = point.plotY + (point.negative ? shapeArgs.height : 0);
			if (series.chart.inverted) {
				point.tooltipPos[0] = yAxis.len - tooltipY;
			} else {
				point.tooltipPos[1] = tooltipY;
			}

		}
	}
930006
def _rank(self, ranking, n):
    
    return nlargest(n, ranking, key=ranking.get)
1265165
def single_row_or_col_df_to_series(desired_type: Type[T], single_rowcol_df: pd.DataFrame, logger: Logger, **kwargs)\
        -> pd.Series:
    
    if single_rowcol_df.shape[0] == 1:
        # one row
        return single_rowcol_df.transpose()[0]
    elif single_rowcol_df.shape[1] == 2 and isinstance(single_rowcol_df.index, pd.RangeIndex):
        # two columns but the index contains nothing but the row number : we can use the first column
        d = single_rowcol_df.set_index(single_rowcol_df.columns[0])
        return d[d.columns[0]]
    elif single_rowcol_df.shape[1] == 1:
        # one column and one index
        d = single_rowcol_df
        return d[d.columns[0]]
    else:
        raise ValueError('Unable to convert provided dataframe to a series : '
                         'expected exactly 1 row or 1 column, found : ' + str(single_rowcol_df.shape) + '')
451933
def dense_rank(expr, sort=None, ascending=True):
    
    return _rank_op(expr, DenseRank, types.int64, sort=sort, ascending=ascending)