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

Method _get_time_micros

pandas/core/indexes/datetimes.py:796–821  ·  view source on GitHub ↗

Return the number of microseconds since midnight. Returns ------- ndarray[int64_t]

(self)

Source from the content-addressed store, hash-verified

794 # --------------------------------------------------------------------
795
796 def _get_time_micros(self) -> npt.NDArray[np.int64]:
797 """
798 Return the number of microseconds since midnight.
799
800 Returns
801 -------
802 ndarray[int64_t]
803 """
804 values = self._data._local_timestamps()
805
806 ppd = periods_per_day(self._data._creso)
807
808 frac = values % ppd
809 if self.unit == "ns":
810 micros = frac // 1000
811 elif self.unit == "us":
812 micros = frac
813 elif self.unit == "ms":
814 micros = frac * 1000
815 elif self.unit == "s":
816 micros = frac * 1_000_000
817 else: # pragma: no cover
818 raise NotImplementedError(self.unit)
819
820 micros[self._isnan] = -1
821 return micros
822
823 def snap(self, freq: Frequency = "S") -> DatetimeIndex:
824 """

Callers 2

indexer_at_timeMethod · 0.95
indexer_between_timeMethod · 0.95

Calls 1

_local_timestampsMethod · 0.80

Tested by

no test coverage detected