date#

class date(*args, **kwargs)[source]#

Bases: Timestamp

Define a single date; based on pd.Timestamp

Parameters:
  • date (int/float/str/datetime) – Any type of date input (ints and floats will be interpreted as years)

  • kwargs (dict) – passed to pd.Timestamp()

Examples:

ss.date(2020) # Returns <2020-01-01>
ss.date(year=2020) # Returns <2020-01-01>
ss.date(year=2024.75) # Returns <2024-10-01>
ss.date('2024-04-04') # Returns <2024-04-04>
ss.date(year=2024, month=4, day=4) # Returns <2024-04-04>

Attributes

asm8

Return numpy datetime64 format in nanoseconds.

day

day_of_week

Return day of the week.

day_of_year

Return the day of the year.

dayofweek

Return day of the week.

dayofyear

Return the day of the year.

days_in_month

Return the number of days in the month.

daysinmonth

Return the number of days in the month.

fold

hour

is_leap_year

Return True if year is a leap year.

is_month_end

Check if the date is the last day of the month.

is_month_start

Check if the date is the first day of the month.

is_quarter_end

Check if date is last day of the quarter.

is_quarter_start

Check if the date is the first day of the quarter.

is_year_end

Return True if date is last day of the year.

is_year_start

Return True if date is first day of the year.

max

microsecond

min

minute

month

nanosecond

quarter

Return the quarter of the year.

resolution

second

tz

Alias for tzinfo.

tzinfo

unit

The abbreviation associated with self._creso.

value

week

Return the week number of the year.

weekofyear

Return the week number of the year.

year

Methods

disp(**kwargs)[source]#

Show the full object

classmethod from_year(year)[source]#

Convert an int or float year to a date.

Examples:

ss.date.from_year(2020) # Returns <2020-01-01>
ss.date.from_year(2024.75) # Returns <2024-10-01>
to_year()[source]#

Convert a date to a floating-point year

Examples:

ss.date('2020-01-01').to_year() # Returns 2020.0
ss.date('2024-10-01').to_year() # Returns 2024.7486
to_pandas()[source]#

Convert to a standard pd.Timestamp instance