Skip to content

Commit 44691ee

Browse files
DOC: update the Series.dt.dayofweek docstring (#21823)
1 parent d05e8f2 commit 44691ee

File tree

1 file changed

+35
-2
lines changed

1 file changed

+35
-2
lines changed

pandas/core/arrays/datetimes.py

+35-2
Original file line numberDiff line numberDiff line change
@@ -617,8 +617,41 @@ def date(self):
617617
weekofyear = _field_accessor('weekofyear', 'woy',
618618
"The week ordinal of the year")
619619
week = weekofyear
620-
dayofweek = _field_accessor('dayofweek', 'dow',
621-
"The day of the week with Monday=0, Sunday=6")
620+
_dayofweek_doc = """
621+
The day of the week with Monday=0, Sunday=6.
622+
623+
Return the day of the week. It is assumed the week starts on
624+
Monday, which is denoted by 0 and ends on Sunday which is denoted
625+
by 6. This method is available on both Series with datetime
626+
values (using the `dt` accessor) or DatetimeIndex.
627+
628+
See Also
629+
--------
630+
Series.dt.dayofweek : Alias.
631+
Series.dt.weekday : Alias.
632+
Series.dt.day_name : Returns the name of the day of the week.
633+
634+
Returns
635+
-------
636+
Series or Index
637+
Containing integers indicating the day number.
638+
639+
Examples
640+
--------
641+
>>> s = pd.date_range('2016-12-31', '2017-01-08', freq='D').to_series()
642+
>>> s.dt.dayofweek
643+
2016-12-31 5
644+
2017-01-01 6
645+
2017-01-02 0
646+
2017-01-03 1
647+
2017-01-04 2
648+
2017-01-05 3
649+
2017-01-06 4
650+
2017-01-07 5
651+
2017-01-08 6
652+
Freq: D, dtype: int64
653+
"""
654+
dayofweek = _field_accessor('dayofweek', 'dow', _dayofweek_doc)
622655
weekday = dayofweek
623656

624657
weekday_name = _field_accessor(

0 commit comments

Comments
 (0)