The is_year_end
attribute of Pandas.Timestamp
(an equivalent of python's Datetime object) is used to check if the date is the last day of the year.
The is_year_end
attribute takes the syntax below:
Timestamp.is_year_end
The attribute takes no parameter values.
This attribute returns a boolean value indicating if the date is the last day of the year. It returns True
if it is the last day and False
if not.
Let's look at the code below:
# A code to illustrate the .is_year_end attribute in Pandas# importing the pandas libraryimport pandas as pd# creating a Timestamp objecta = pd.Timestamp(2022, 12, 30)b = pd.Timestamp(2022, 12, 31)# checking if date is the last day of the yearprint(a.is_year_end)print(b.is_year_end)
pandas
library.Timestamp
objects, a
and b
, representing the month of December.is_year_end
to indicate if any of the dates are the year's last day.