diff --git a/xarray/core/variable.py b/xarray/core/variable.py index 433f4a05e1f..93424474d05 100644 --- a/xarray/core/variable.py +++ b/xarray/core/variable.py @@ -1597,7 +1597,7 @@ def rank(self, dim, pct=False): "prior to calling this method.") axis = self.get_axis_num(dim) - func = bn.nanrankdata if self.dtype.kind is 'f' else bn.rankdata + func = bn.nanrankdata if self.dtype.kind == 'f' else bn.rankdata ranked = func(self.data, axis=axis) if pct: count = np.sum(~np.isnan(self.data), axis=axis, keepdims=True)