code: def rank(self,
               method='ordinal',
               ascending=True,
               mask=NotSpecified,
               groupby=NotSpecified):
          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,
          )