Skip to content

datetime_nb module

Numba-compiled utilities for working with dates and time.


DTCS DTCST

Status returned by within_fixed_dtc_nb() and within_periodic_dtc_nb().

DTCST(
    SU=-3,
    EU=-2,
    U=-1,
    O=0,
    I=1
)

Attributes

SU
Start matched, rest unknown. Move down the stack.
EU
End matched, rest unknown. Move down the stack.
U
Unknown. Move down the stack.
O
Outside
I
Inside

d_ns int

Day in nanoseconds.


d_td timedelta64

Day as a timedelta.


h_ns int

Hour in nanoseconds.


h_td timedelta64

Hour as a timedelta.


m_ns int

Minute in nanoseconds.


m_td timedelta64

Minute as a timedelta.


mo_ns int

Month in nanoseconds.


mo_td timedelta64

Month as a timedelta.


ms_ns int

Millisecond in nanoseconds.


ms_td timedelta64

Millisecond as a timedelta.


ns_td timedelta64

Nanosecond as a timedelta.


q_ns int

Quarter in nanoseconds.


q_td timedelta64

Quarter as a timedelta.


s_ns int

Second in nanoseconds.


s_td timedelta64

Second as a timedelta.


semi_mo_ns int

Semi-month in nanoseconds.


semi_mo_td timedelta64

Semi-month as a timedelta.


unix_epoch_dt datetime64

Unix epoch (datetime).


us_ns int

Microsecond in nanoseconds.


us_td timedelta64

Microsecond as a timedelta.


w_ns int

Week in nanoseconds.


w_td timedelta64

Week as a timedelta.


y_ns int

Year in nanoseconds.


y_td timedelta64

Year as a timedelta.


day_changed_nb function

day_changed_nb(
    ts1,
    ts2
)

Whether the day changed.


day_nb function

day_nb(
    ts
)

Get the day of the month.


day_of_year_nb function

day_of_year_nb(
    ts
)

Get the day of the year.


days_nb function

days_nb(
    ts
)

Get the number of days.


from_civil_nb function

from_civil_nb(
    y,
    m,
    d
)

Convert a year, month, and day into the timestamp.


future_weekday_nb function

future_weekday_nb(
    ts,
    weekday,
    zero_start=True
)

Get the timestamp of a weekday in the future.


hour_nb function

hour_nb(
    ts
)

Get the hour.


hours_nb function

hours_nb(
    ts
)

Get the number of hours.


index_matches_dtc_nb function

index_matches_dtc_nb(
    index,
    other_dtc
)

Run matches_dtc_nb() on each element in an index and return a mask.


index_within_dtc_range_nb function

index_within_dtc_range_nb(
    index,
    start_dtc,
    end_dtc,
    closed_start=True,
    closed_end=False
)

Run within_dtc_range_nb() on each element in an index and return a mask.


is_leap_year_nb function

is_leap_year_nb(
    y
)

Get whether the year is a leap year.


last_day_of_month_nb function

last_day_of_month_nb(
    y,
    m
)

Get the last day of the month.


matches_date_nb function

matches_date_nb(
    ts,
    y,
    m,
    d
)

Check whether the timestamp match the date provided in the civil format.


matches_dtc_nb function

matches_dtc_nb(
    dtc,
    other_dtc
)

Return whether one or more datetime components match other components.


microsecond_nb function

microsecond_nb(
    ts
)

Get the microsecond.


microseconds_nb function

microseconds_nb(
    ts
)

Get the number of microseconds.


midnight_nb function

midnight_nb(
    ts
)

Get the midnight of this day.


millisecond_nb function

millisecond_nb(
    ts
)

Get the millisecond.


milliseconds_nb function

milliseconds_nb(
    ts
)

Get the number of milliseconds.


minute_nb function

minute_nb(
    ts
)

Get the minute.


minutes_nb function

minutes_nb(
    ts
)

Get the number of minutes.


month_nb function

month_nb(
    ts
)

Get the month of the year.


must_resolve_dtc_nb function

must_resolve_dtc_nb(
    c=None,
    start_c=None,
    end_c=None
)

Return whether the component must be resolved.


nanosecond_nb function

nanosecond_nb(
    ts
)

Get the nanosecond.


past_weekday_nb function

past_weekday_nb(
    ts,
    weekday,
    zero_start=True
)

Get the timestamp of a weekday in the past.


second_nb function

second_nb(
    ts
)

Get the seconds.


second_remainder_nb function

second_remainder_nb(
    ts
)

Get the nanosecond remainder after the second.


seconds_nb function

seconds_nb(
    ts
)

Get the number of seconds.


start_dtc_eq_nb function

start_dtc_eq_nb(
    c=None,
    start_c=None,
    end_c=None
)

Return whether the start component equals to the end component.


start_dtc_gt_nb function

start_dtc_gt_nb(
    c=None,
    start_c=None,
    end_c=None
)

Return whether the start component is greater than the end component.


start_dtc_lt_nb function

start_dtc_lt_nb(
    c=None,
    start_c=None,
    end_c=None
)

Return whether the start component is less than the end component.


to_civil_nb function

to_civil_nb(
    ts
)

Convert a timestamp into a tuple of the year, month, and day.


week_nb function

week_nb(
    ts
)

Get the week of the year.


weekday_diff_nb function

weekday_diff_nb(
    weekday1,
    weekday2,
    zero_start=True
)

Get the difference in days between two weekdays.


weekday_from_days_nb function

weekday_from_days_nb(
    days,
    zero_start=True
)

Get the weekday from the total number of days.

Weekdays are ranging from 0 (Monday) to 6 (Sunday).


weekday_nb function

weekday_nb(
    ts,
    zero_start=True
)

Get the weekday.

Weekdays are ranging from 0 (Monday) to 6 (Sunday).


within_dtc_range_nb function

within_dtc_range_nb(
    dtc,
    start_dtc,
    end_dtc,
    closed_start=True,
    closed_end=False
)

Return whether one or more datetime components are within a range.


within_fixed_dtc_nb function

within_fixed_dtc_nb(
    c,
    start_c=None,
    end_c=None,
    prev_status=-1,
    closed_start=True,
    closed_end=False,
    is_last=False
)

Return whether a single datetime component is within a fixed range.

Returns a status of the type DTCS.


within_periodic_dtc_nb function

within_periodic_dtc_nb(
    c,
    start_c=None,
    end_c=None,
    prev_status=-1,
    closed_start=True,
    closed_end=False,
    overflow_later=False,
    is_last=False
)

Return whether a single datetime component is within a periodic range.

Returns a status of the type DTCS.


year_nb function

year_nb(
    ts
)

Get the year.


DTCST class

DTCST(
    SU=-3,
    EU=-2,
    U=-1,
    O=0,
    I=1
)

DTCST(SU, EU, U, O, I)

Superclasses

  • builtins.tuple

EU method-wrapper

Alias for field number 1


I method-wrapper

Alias for field number 4


O method-wrapper

Alias for field number 3


SU method-wrapper

Alias for field number 0


U method-wrapper

Alias for field number 2