File tree 1 file changed +37
-1
lines changed
1 file changed +37
-1
lines changed Original file line number Diff line number Diff line change @@ -1945,7 +1945,43 @@ def freq(self, value):
1945
1945
is_leap_year = _field_accessor (
1946
1946
'is_leap_year' ,
1947
1947
'is_leap_year' ,
1948
- "Logical indicating if the date belongs to a leap year" )
1948
+ """
1949
+ Boolean indicator if the date belongs to a leap year.
1950
+
1951
+ A leap year is a year, which has 366 days (instead of 365) including
1952
+ 29th of February as an intercalary day.
1953
+ Leap years are years which are multiples of four with the exception
1954
+ of years divisible by 100 but not by 400.
1955
+
1956
+ Returns
1957
+ -------
1958
+ Series or ndarray
1959
+ Booleans indicating if dates belong to a leap year.
1960
+
1961
+ Examples
1962
+ --------
1963
+ This method is available on Series with datetime values under
1964
+ the ``.dt`` accessor, and directly on DatetimeIndex.
1965
+
1966
+ >>> idx = pd.date_range("2012-01-01", "2015-01-01", freq="Y")
1967
+ >>> idx
1968
+ DatetimeIndex(['2012-12-31', '2013-12-31', '2014-12-31'],
1969
+ dtype='datetime64[ns]', freq='A-DEC')
1970
+ >>> idx.is_leap_year
1971
+ array([ True, False, False], dtype=bool)
1972
+
1973
+ >>> dates = pd.Series(idx)
1974
+ >>> dates_series
1975
+ 0 2012-12-31
1976
+ 1 2013-12-31
1977
+ 2 2014-12-31
1978
+ dtype: datetime64[ns]
1979
+ >>> dates_series.dt.is_leap_year
1980
+ 0 True
1981
+ 1 False
1982
+ 2 False
1983
+ dtype: bool
1984
+ """ )
1949
1985
1950
1986
@property
1951
1987
def time (self ):
You can’t perform that action at this time.
0 commit comments