pandas.DatetimeIndex.is_year_start#

property DatetimeIndex.is_year_start[source]#

Indicate whether the date is the first day of a year.

This boolean attribute evaluates to True if the date is January 1st, and False otherwise. If the index has a business or anchored freq (e.g. "BYS" or "YS-APR"), the result follows that frequency’s year boundaries instead of the calendar’s.

See also

DatetimeIndex.is_year_end

Similar property indicating the last day of the year.

Examples

>>> idx = pd.date_range("2017-12-30", periods=3)
>>> idx.is_year_start
array([False, False,  True])

With a business freq, the first business day of the year counts as the year start even when it is not January 1st:

>>> idx = pd.date_range("2020-10-30", periods=4, freq="BYS")
>>> idx
DatetimeIndex(['2021-01-01', '2022-01-03', '2023-01-02', '2024-01-01'],
              dtype='datetime64[us]', freq='BYS-JAN')
>>> idx.is_year_start
array([ True,  True,  True,  True])