MCPcopy
hub / github.com/pandas-dev/pandas / __floordiv__

Method __floordiv__

pandas/core/indexes/range.py:1319–1332  ·  view source on GitHub ↗
(self, other)

Source from the content-addressed store, hash-verified

1317
1318 @unpack_zerodim_and_defer("__floordiv__")
1319 def __floordiv__(self, other):
1320 if is_integer(other) and other != 0:
1321 if len(self) == 0 or (self.start % other == 0 and self.step % other == 0):
1322 start = self.start // other
1323 step = self.step // other
1324 stop = start + len(self) * step
1325 new_range = range(start, stop, step or 1)
1326 return self._simple_new(new_range, name=self._name)
1327 if len(self) == 1:
1328 start = self.start // other
1329 new_range = range(start, start + 1, 1)
1330 return self._simple_new(new_range, name=self._name)
1331
1332 return super().__floordiv__(other)
1333
1334 # --------------------------------------------------------------------
1335 # Reductions

Callers

nothing calls this directly

Calls 1

_simple_newMethod · 0.95

Tested by

no test coverage detected