Skip to content

Commit 2f11edf

Browse files
CLN: Resolve comments from @arw2019
Alias dep. function instead of extra property Remove comments from test files
1 parent 20a447d commit 2f11edf

File tree

5 files changed

+5
-15
lines changed

5 files changed

+5
-15
lines changed

pandas/_libs/tslibs/period.pyx

+3-5
Original file line numberDiff line numberDiff line change
@@ -1475,6 +1475,9 @@ cdef class _Period(PeriodMixin):
14751475
PeriodDtypeBase _dtype
14761476
BaseOffset freq
14771477

1478+
# Alias dayofweek function to day_of_week (GH-9606)
1479+
dayofweek = _Period.day_of_week
1480+
14781481
def __cinit__(self, int64_t ordinal, BaseOffset freq):
14791482
self.ordinal = ordinal
14801483
self.freq = freq
@@ -1932,11 +1935,6 @@ cdef class _Period(PeriodMixin):
19321935
base = self._dtype._dtype_code
19331936
return pweekday(self.ordinal, base)
19341937

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-
19401938
@property
19411939
def weekday(self) -> int:
19421940
"""

pandas/_libs/tslibs/timestamps.pyx

+2-7
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,8 @@ cdef class _Timestamp(ABCTimestamp):
230230

231231
# higher than np.ndarray and np.matrix
232232
__array_priority__ = 100
233+
# Alias dayofweek function to day_of_week (GH-9606)
234+
dayofweek = _Timestamp.day_of_week
233235

234236
def __hash__(_Timestamp self):
235237
if self.nanosecond:
@@ -544,13 +546,6 @@ cdef class _Timestamp(ABCTimestamp):
544546
"""
545547
return self.weekday()
546548

547-
@property
548-
def dayofweek(self) -> int:
549-
"""
550-
Deprecated. Use day_of_week instead.
551-
"""
552-
return self.day_of_week
553-
554549
@property
555550
def dayofyear(self) -> int:
556551
"""

pandas/tests/generic/test_finalize.py

-1
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,6 @@ def test_datetime_method(method):
678678
"microsecond",
679679
"nanosecond",
680680
"dayofweek",
681-
# Add better named field for GH-9606
682681
"day_of_week",
683682
"dayofyear",
684683
"quarter",

pandas/tests/indexes/datetimes/test_scalar_compat.py

-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ def test_dti_date_out_of_range(self, data):
3838
"field",
3939
[
4040
"dayofweek",
41-
# Add better named field for GH-9606
4241
"day_of_week",
4342
"dayofyear",
4443
"quarter",

pandas/tests/indexes/period/test_period.py

-1
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,6 @@ def _check_all_fields(self, periodindex):
249249
"weekofyear",
250250
"week",
251251
"dayofweek",
252-
# Add better named field for GH-9606
253252
"day_of_week",
254253
"dayofyear",
255254
"quarter",

0 commit comments

Comments
 (0)