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

Method _unbox_scalar

pandas/core/arrays/datetimes.py:542–549  ·  view source on GitHub ↗
(self, value)

Source from the content-addressed store, hash-verified

540 # DatetimeLike Interface
541
542 def _unbox_scalar(self, value) -> np.datetime64:
543 if not isinstance(value, self._scalar_type) and value is not NaT:
544 raise ValueError("'value' should be a Timestamp.")
545 self._check_compatible_with(value)
546 if value is NaT:
547 return np.datetime64(value._value, self.unit)
548 else:
549 return value.as_unit(self.unit, round_ok=False).asm8
550
551 def _scalar_from_string(self, value) -> Timestamp | NaTType:
552 return Timestamp(value, tz=self.tz)

Callers

nothing calls this directly

Calls 2

as_unitMethod · 0.45

Tested by

no test coverage detected