pub enum TimedeltaStringResolution {
Days,
Full,
}Expand description
How astype(str) renders a timedelta64[ns] COLUMN.
⚠️ THE TIMEDELTA LADDER IS NOT THE DATETIME ONE, and copying the sibling
across is the mistake this type exists to prevent. It has exactly TWO rungs,
and — unlike DatetimeStringResolution — THE SUB-SECOND WIDTH IS PER
VALUE, not per column. MEASURED, live pandas 2.2.3:
[1 days, 2 days] -> ['1 days', '2 days']
[1 days, 5 ms] -> ['1 days 00:00:00', '0 days 00:00:00.005000']
[1 days 02:03:04.005, 1 ns] -> ['1 days 02:03:04.005000',
'0 days 00:00:00.000000001']That last row is the whole distinction: a millisecond value keeps its SIX
digits while its neighbour prints NINE. On the datetime side the same pair
would have been widened to a common nine. So the only column-wide question
here is whether the time-of-day part can be dropped entirely, which is what
Timedelta::string_resolution answers; Timedelta::format already gets
the per-value part right and is reused unchanged.
Variants§
Days
1 days / -2 days / 0 days — every value is a whole day.
Full
1 days 02:03:04.005000 — the full rendering, sub-second width per value.
Trait Implementations§
Source§impl Clone for TimedeltaStringResolution
impl Clone for TimedeltaStringResolution
Source§fn clone(&self) -> TimedeltaStringResolution
fn clone(&self) -> TimedeltaStringResolution
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more