- API reference
- Series
- pandas.Serie...
pandas.Series.dt.is_year_start#
- Series.dt.is_year_start[source]#
Indicate whether the date is the first day of a year.
- Returns:
- Series or DatetimeIndex
The same type as the original data with boolean values. Series willhave the same name and index. DatetimeIndex will have the samename.
See also
is_year_end
Similar property indicating the last day of the year.
Examples
This method is available on Series with datetime values underthe
.dt
accessor, and directly on DatetimeIndex.>>>dates=pd.Series(pd.date_range("2017-12-30",periods=3))>>>dates0 2017-12-301 2017-12-312 2018-01-01dtype: datetime64[ns]
>>>dates.dt.is_year_start0 False1 False2 Truedtype: bool
>>>idx=pd.date_range("2017-12-30",periods=3)>>>idxDatetimeIndex(['2017-12-30', '2017-12-31', '2018-01-01'], dtype='datetime64[ns]', freq='D')
>>>idx.is_year_startarray([False, False, True])
On this page