@@ -1373,7 +1373,7 @@ cdef accessor _get_accessor_func(str field):
1373
1373
return < accessor> pweek
1374
1374
elif field == " day_of_year" :
1375
1375
return < accessor> pday_of_year
1376
- elif field == " weekday" :
1376
+ elif field == " weekday" or field == " day_of_week " :
1377
1377
return < accessor> pweekday
1378
1378
elif field == " days_in_month" :
1379
1379
return < accessor> pdays_in_month
@@ -1882,7 +1882,7 @@ cdef class _Period(PeriodMixin):
1882
1882
return self.weekofyear
1883
1883
1884
1884
@property
1885
- def dayofweek (self ) -> int:
1885
+ def day_of_week (self ) -> int:
1886
1886
"""
1887
1887
Day of the week the period lies in , with Monday = 0 and Sunday= 6.
1888
1888
@@ -1900,38 +1900,43 @@ cdef class _Period(PeriodMixin):
1900
1900
1901
1901
See Also
1902
1902
--------
1903
- Period.dayofweek : Day of the week the period lies in.
1904
- Period.weekday : Alias of Period.dayofweek .
1903
+ Period.day_of_week : Day of the week the period lies in.
1904
+ Period.weekday : Alias of Period.day_of_week .
1905
1905
Period.day : Day of the month.
1906
1906
Period.dayofyear : Day of the year.
1907
1907
1908
1908
Examples
1909
1909
--------
1910
1910
>>> per = pd.Period(' 2017-12-31 22:00' , ' H' )
1911
- >>> per.dayofweek
1911
+ >>> per.day_of_week
1912
1912
6
1913
1913
1914
1914
For periods that span over multiple days , the day at the beginning of
1915
1915
the period is returned.
1916
1916
1917
1917
>>> per = pd.Period(' 2017-12-31 22:00' , ' 4H' )
1918
- >>> per.dayofweek
1918
+ >>> per.day_of_week
1919
1919
6
1920
- >>> per.start_time.dayofweek
1920
+ >>> per.start_time.day_of_week
1921
1921
6
1922
1922
1923
1923
For periods with a frequency higher than days , the last day of the
1924
1924
period is returned.
1925
1925
1926
1926
>>> per = pd.Period(' 2018-01' , ' M' )
1927
- >>> per.dayofweek
1927
+ >>> per.day_of_week
1928
1928
2
1929
- >>> per.end_time.dayofweek
1929
+ >>> per.end_time.day_of_week
1930
1930
2
1931
1931
"""
1932
1932
base = self ._dtype._dtype_code
1933
1933
return pweekday(self.ordinal , base )
1934
1934
1935
+ @property
1936
+ def dayofweek(self ) -> int:
1937
+ """This property is deprecated. Please use day_of_week instead."""
1938
+ return self.day_of_week
1939
+
1935
1940
@property
1936
1941
def weekday(self ) -> int:
1937
1942
"""
0 commit comments