Data limits expansion#
Data limits expansion allows bounds inferred from and available data argument to stretch outward slightly, toward the likely “real” limits of the data.
from pandas import Timestamp
from time_split.support import expand_limits
limits = Timestamp("2019-05-11"), Timestamp("2019-05-11 22:05:30")
expanded = expand_limits(limits, "d")
assert expanded == (
Timestamp('2019-05-11 00:00:00'),
Timestamp('2019-05-12 00:00:00'),
)
See support.expand_limits() for more examples and manual experimentation.
Type |
Description |
|---|---|
|
Disable expand_limits; use real limits instead. |
|
Auto-expand_limits using Snap limits to the nearest |
|
Manual expand_limits specification. Pass an offset alias specify how limits should be rounded. To specify
by how much limits may be rounded, pass two offset aliases separated by a For example, passing |
The expand_limits() function uses level tuples on the form (start_at, round_to, tolerance) internally.
These may be passed directly to expand_limits(), but not to any other functions. Use the types above instead.