Skip to content

datethyme.DateTimePartition

This is the documentation page for the DateTimePartition class.

datethyme.DateTimePartition

Bases: PartitionProtocol

TODO: add nesting_mode to determine how nested time partitions are resized under different operations

_names instance-attribute

_names = tuple(names) if names else names

_spans instance-attribute

_spans = spans

daterange property

daterange: DateRange

days property

days: float

end property

end: DateTime

ends property

ends: tuple[DateTime, ...]

hours property

hours: float

minutes property

minutes: float

named_spans property

named_spans: tuple[tuple[str, DateTimeSpan], ...]

names property

names: tuple[str, ...]

passes_day_boundary property

passes_day_boundary: bool

seconds property

seconds: float

span property

span: DateTimeSpan

spans property

spans: tuple[DateTimeSpan, ...]

start property

start: DateTime

starts property

starts: tuple[DateTime, ...]

ALT__repr__

ALT__repr__()

__bool__

__bool__() -> bool

__contains__

__contains__(other) -> bool

__init__

__init__(spans: Iterable[DateTimeSpan], names: Iterable[str | None] | None = None)

__repr__

__repr__()

__str__

__str__()

affine_transform

affine_transform(scale_factor: float, new_start: DateTime | None = None, new_end: DateTime | None = None, min_minutes: int | float = 5) -> Self

contains abstractmethod

contains(other, include_start: bool = True, include_end: bool = False) -> bool

format_span

format_span(span: DateTimeSpan | DateTimePartition, indent: int = 0)

from_boundaries classmethod

from_boundaries(times: Iterable[DateTime], names: Iterable[str | None] | None = None) -> Self

from_datetimes classmethod

from_datetimes(times: Iterable[DateTime], names: Iterable[str | None] | None = None) -> Self

from_deltas classmethod

from_deltas(*, durations: Iterable[DeltaProtocol], start: DateTime | None, end: DateTime | None, names: Iterable[str | None] | None = None) -> Self

from_durations classmethod

from_durations(*, durations: Iterable[int | float], start: DateTime | None, end: DateTime | None, names: Iterable[str | None] | None = None) -> Self

from_minutes_and_end classmethod

from_minutes_and_end(end: DateTime, segments: Iterable[float], names: Iterable[str | None] | None = None) -> Self

from_minutes_and_start classmethod

from_minutes_and_start(start: DateTime, segments: Iterable[float], names: Iterable[str | None] | None = None) -> Self

from_partition classmethod

from_partition(segments: Iterable[DateTimeSpan], names: Iterable[str | None] | None = None) -> Self

from_pipeline classmethod

from_pipeline(segments: Iterable[DateTimeSpan], pipeline: Iterable[Callable[[Iterable[DateTimeSpan]], Iterable[DateTimeSpan]]], names: Iterable[str | None] | None = None) -> Self

from_relative_lengths classmethod

from_relative_lengths(start: DateTime, end: DateTime, segments: Iterable[float], names: Iterable[str | None] | None = None) -> Self

from_times classmethod

from_times(times: Iterable[Time], names: Iterable[str | None] | None = None) -> DateTimePartition

gap

gap(other, strict: bool = False) -> DateTimeSpan | None

hull

hull(other, strict: bool = False) -> DateTimeSpan

index_from_name

index_from_name(name: str) -> int | None

index_from_time

index_from_time(point: DateTime) -> int | None

insert

insert(span_start: DateTime | int, new_span: DateTimeSpan, mode: Literal['SQUEEZE', 'PUSH_BACK', 'PUSH_FORWARD'], split_incumbent: bool = True) -> DateTimePartition

interior_point

interior_point(alpha: float) -> DateTime

intersection

intersection(other, strict: bool = False) -> DateTimePartition | None

iter_nested

iter_nested() -> Iterator[tuple[int, DateTimeSpan]]

overlap

overlap(other, strict: bool = False) -> DateTimePartition | None

reordered

reordered(orderer: Callable[[DateTimeSpan], int | float | str | DateTime]) -> Self

round_hours

round_hours(round_to: int) -> Self

round_minutes

round_minutes(round_to: int) -> Self

round_seconds

round_seconds(round_to: float) -> Self

shift_end_rigid

shift_end_rigid(new_end: DateTime) -> DateTimePartition

shift_start_rigid

shift_start_rigid(new_start: DateTime) -> DateTimePartition

snap_end_to

snap_end_to(new_end: DateTime) -> DateTimePartition

snap_start_to

snap_start_to(new_start: DateTime) -> DateTimePartition

span_containing

span_containing(point: DateTime) -> DateTimeSpan | None

split

split(cut_point: DateTime) -> tuple[DateTimePartition, DateTimePartition]