def rank(self, axis=0, method='average', numeric_only=None, na_option='keep', ascending=True, pct=False):
    "\n        Compute numerical data ranks (1 through n) along axis. Equal values are\n        assigned a rank that is the average of the ranks of those values.\n\n        Parameters\n        ----------\n        axis : {0 or 'index', 1 or 'columns'}, default 0\n            index to direct ranking\n        method : {'average', 'min', 'max', 'first', 'dense'}\n            * average: average rank of group\n            * min: lowest rank in group\n            * max: highest rank in group\n            * first: ranks assigned in order they appear in the array\n            * dense: like 'min', but rank always increases by 1 between groups\n        numeric_only : boolean, default None\n            Include only float, int, boolean data. Valid only for DataFrame or\n            Panel objects\n        na_option : {'keep', 'top', 'bottom'}\n            * keep: leave NA values where they are\n            * top: smallest rank if ascending\n            * bottom: smallest rank if descending\n        ascending : boolean, default True\n            False for ranks by high (1) to low (N)\n        pct : boolean, default False\n            Computes percentage rank of data\n\n        Returns\n        -------\n        ranks : same type as caller\n        "
    axis = self._get_axis_number(axis)
    if (self.ndim > 2):
        msg = 'rank does not make sense when ndim > 2'
        raise NotImplementedError(msg)
    if (na_option not in {'keep', 'top', 'bottom'}):
        msg = "na_option must be one of 'keep', 'top', or 'bottom'"
        raise ValueError(msg)

    def ranker(data):
        ranks = algos.rank(data.values, axis=axis, method=method, ascending=ascending, na_option=na_option, pct=pct)
        ranks = self._constructor(ranks, **data._construct_axes_dict())
        return ranks.__finalize__(self)
    if (numeric_only is None):
        try:
            return ranker(self)
        except TypeError:
            numeric_only = True
    if numeric_only:
        data = self._get_numeric_data()
    else:
        data = self
    return ranker(data)
Compute numerical data ranks (1 through n) along axis. Equal values are
assigned a rank that is the average of the ranks of those values.

Parameters
----------
axis : {0 or 'index', 1 or 'columns'}, default 0
    index to direct ranking
method : {'average', 'min', 'max', 'first', 'dense'}
    * average: average rank of group
    * min: lowest rank in group
    * max: highest rank in group
    * first: ranks assigned in order they appear in the array
    * dense: like 'min', but rank always increases by 1 between groups
numeric_only : boolean, default None
    Include only float, int, boolean data. Valid only for DataFrame or
    Panel objects
na_option : {'keep', 'top', 'bottom'}
    * keep: leave NA values where they are
    * top: smallest rank if ascending
    * bottom: smallest rank if descending
ascending : boolean, default True
    False for ranks by high (1) to low (N)
pct : boolean, default False
    Computes percentage rank of data

Returns
-------
ranks : same type as caller
def rank(self, axis=0, method='average', numeric_only=None, na_option='keep', ascending=True, pct=False):
    "\n        Compute numerical data ranks (1 through n) along axis. Equal values are\n        assigned a rank that is the average of the ranks of those values.\n\n        Parameters\n        ----------\n        axis : {0 or 'index', 1 or 'columns'}, default 0\n            index to direct ranking\n        method : {'average', 'min', 'max', 'first', 'dense'}\n            * average: average rank of group\n            * min: lowest rank in group\n            * max: highest rank in group\n            * first: ranks assigned in order they appear in the array\n            * dense: like 'min', but rank always increases by 1 between groups\n        numeric_only : boolean, default None\n            Include only float, int, boolean data. Valid only for DataFrame or\n            Panel objects\n        na_option : {'keep', 'top', 'bottom'}\n            * keep: leave NA values where they are\n            * top: smallest rank if ascending\n            * bottom: smallest rank if descending\n        ascending : boolean, default True\n            False for ranks by high (1) to low (N)\n        pct : boolean, default False\n            Computes percentage rank of data\n\n        Returns\n        -------\n        ranks : same type as caller\n        "
    axis = self._get_axis_number(axis)
    if (self.ndim > 2):
        msg = 'rank does not make sense when ndim > 2'
        raise NotImplementedError(msg)
    if (na_option not in {'keep', 'top', 'bottom'}):
        msg = "na_option must be one of 'keep', 'top', or 'bottom'"
        raise ValueError(msg)

    def ranker(data):
        ranks = algos.rank(data.values, axis=axis, method=method, ascending=ascending, na_option=na_option, pct=pct)
        ranks = self._constructor(ranks, **data._construct_axes_dict())
        return ranks.__finalize__(self)
    if (numeric_only is None):
        try:
            return ranker(self)
        except TypeError:
            numeric_only = True
    if numeric_only:
        data = self._get_numeric_data()
    else:
        data = self
    return ranker(data)