nodes: 0, module; 1, function_definition; 2, function_name:rank; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, if_statement; 12, return_statement; 13, identifier:method; 14, string; 15, identifier:ascending; 16, True; 17, identifier:mask; 18, identifier:NotSpecified; 19, identifier:groupby; 20, identifier:NotSpecified; 21, comment:"""
          Construct a new Factor representing the sorted rank of each column
          within each row.
  
          Parameters
          ----------
          method : str, {'ordinal', 'min', 'max', 'dense', 'average'}
              The method used to assign ranks to tied elements. See
              `scipy.stats.rankdata` for a full description of the semantics for
              each ranking method. Default is 'ordinal'.
          ascending : bool, optional
              Whether to return sorted rank in ascending or descending order.
              Default is True.
          mask : zipline.pipeline.Filter, optional
              A Filter representing assets to consider when computing ranks.
              If mask is supplied, ranks are computed ignoring any asset/date
              pairs for which `mask` produces a value of False.
          groupby : zipline.pipeline.Classifier, optional
              A classifier defining partitions over which to perform ranking.
  
          Returns
          -------
          ranks : zipline.pipeline.factors.Rank
              A new factor that will compute the ranking of the data produced by
              `self`.
  
          Notes
          -----
          The default value for `method` is different from the default for
          `scipy.stats.rankdata`.  See that function's documentation for a full
          description of the valid inputs to `method`.
  
          Missing or non-existent data on a given day will cause an asset to be
          given a rank of NaN for that day.
  
          See Also
          --------
          :func:`scipy.stats.rankdata`
          :class:`zipline.pipeline.factors.factor.Rank`
          """; 22, comparison_operator:groupby is NotSpecified; 23, block; 24, call; 25, string_content:ordinal; 26, identifier:groupby; 27, identifier:NotSpecified; 28, return_statement; 29, identifier:GroupedRowTransform; 30, argument_list; 31, call; 32, keyword_argument; 33, keyword_argument; 34, keyword_argument; 35, keyword_argument; 36, keyword_argument; 37, keyword_argument; 38, keyword_argument; 39, keyword_argument; 40, identifier:Rank; 41, argument_list; 42, identifier:transform; 43, conditional_expression:rankdata if ascending else rankdata_1d_descending; 44, identifier:transform_args; 45, tuple; 46, identifier:factor; 47, identifier:self; 48, identifier:groupby; 49, identifier:groupby; 50, identifier:dtype; 51, identifier:float64_dtype; 52, identifier:missing_value; 53, identifier:nan; 54, identifier:mask; 55, identifier:mask; 56, identifier:window_safe; 57, True; 58, identifier:self; 59, keyword_argument; 60, keyword_argument; 61, keyword_argument; 62, identifier:rankdata; 63, identifier:ascending; 64, identifier:rankdata_1d_descending; 65, identifier:method; 66, identifier:method; 67, identifier:method; 68, identifier:ascending; 69, identifier:ascending; 70, identifier:mask; 71, identifier:mask
code: def rank(self,
               method='ordinal',
               ascending=True,
               mask=NotSpecified,
               groupby=NotSpecified):
          """
          Construct a new Factor representing the sorted rank of each column
          within each row.
  
          Parameters
          ----------
          method : str, {'ordinal', 'min', 'max', 'dense', 'average'}
              The method used to assign ranks to tied elements. See
              `scipy.stats.rankdata` for a full description of the semantics for
              each ranking method. Default is 'ordinal'.
          ascending : bool, optional
              Whether to return sorted rank in ascending or descending order.
              Default is True.
          mask : zipline.pipeline.Filter, optional
              A Filter representing assets to consider when computing ranks.
              If mask is supplied, ranks are computed ignoring any asset/date
              pairs for which `mask` produces a value of False.
          groupby : zipline.pipeline.Classifier, optional
              A classifier defining partitions over which to perform ranking.
  
          Returns
          -------
          ranks : zipline.pipeline.factors.Rank
              A new factor that will compute the ranking of the data produced by
              `self`.
  
          Notes
          -----
          The default value for `method` is different from the default for
          `scipy.stats.rankdata`.  See that function's documentation for a full
          description of the valid inputs to `method`.
  
          Missing or non-existent data on a given day will cause an asset to be
          given a rank of NaN for that day.
  
          See Also
          --------
          :func:`scipy.stats.rankdata`
          :class:`zipline.pipeline.factors.factor.Rank`
          """
  
          if groupby is NotSpecified:
              return Rank(self, method=method, ascending=ascending, mask=mask)
  
          return GroupedRowTransform(
              transform=rankdata if ascending else rankdata_1d_descending,
              transform_args=(method,),
              factor=self,
              groupby=groupby,
              dtype=float64_dtype,
              missing_value=nan,
              mask=mask,
              window_safe=True,
          )