Skip to content

Commit 3b22498

Browse files
DOC: Fix ES01 for pandas.Series.dt
1 parent 5eb1110 commit 3b22498

File tree

6 files changed

+117
-67
lines changed

6 files changed

+117
-67
lines changed

ci/code_checks.sh

Lines changed: 0 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -136,39 +136,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
136136
-i "pandas.Series.at_time ES01" \
137137
-i "pandas.Series.cat ES01" \
138138
-i "pandas.Series.sparse ES01" \
139-
-i "pandas.Series.dt.year ES01" \
140-
-i "pandas.Series.dt.month ES01" \
141-
-i "pandas.Series.dt.day ES01" \
142-
-i "pandas.Series.dt.hour ES01" \
143-
-i "pandas.Series.dt.minute ES01" \
144-
-i "pandas.Series.dt.second ES01" \
145-
-i "pandas.Series.dt.microsecond ES01" \
146-
-i "pandas.Series.dt.nanosecond ES01" \
147-
-i "pandas.Series.dt.dayofyear ES01" \
148-
-i "pandas.Series.dt.day_of_year ES01" \
149-
-i "pandas.Series.dt.days_in_month ES01" \
150-
-i "pandas.Series.dt.quarter ES01" \
151-
-i "pandas.Series.dt.is_month_start ES01" \
152-
-i "pandas.Series.dt.is_month_end ES01" \
153-
-i "pandas.Series.dt.is_quarter_start ES01" \
154-
-i "pandas.Series.dt.is_quarter_end ES01" \
155-
-i "pandas.Series.dt.is_year_start ES01" \
156-
-i "pandas.Series.dt.is_year_end ES01" \
157-
-i "pandas.Series.dt.daysinmonth ES01" \
158-
-i "pandas.Series.dt.tz ES01" \
159-
-i "pandas.Series.dt.isocalendar ES01" \
160-
-i "pandas.Series.dt.tz_convert ES01" \
161-
-i "pandas.Series.dt.round ES01" \
162-
-i "pandas.Series.dt.floor ES01" \
163-
-i "pandas.Series.dt.ceil ES01" \
164-
-i "pandas.Series.dt.month_name ES01" \
165-
-i "pandas.Series.dt.day_name ES01" \
166-
-i "pandas.Series.dt.start_time ES01" \
167-
-i "pandas.Series.dt.end_time ES01" \
168-
-i "pandas.Series.dt.days ES01" \
169-
-i "pandas.Series.dt.seconds ES01" \
170-
-i "pandas.Series.dt.microseconds ES01" \
171-
-i "pandas.Series.dt.nanoseconds ES01" \
172139
-i "pandas.Series.cat.ordered ES01" \
173140
-i "pandas.Series.cat.codes ES01" \
174141
-i "pandas.Series.cat.as_ordered ES01" \
@@ -237,14 +204,12 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
237204
-i "pandas.Timedelta.round ES01" \
238205
-i "pandas.Period.days_in_month ES01" \
239206
-i "pandas.Period.daysinmonth ES01" \
240-
-i "pandas.Period.end_time ES01" \
241207
-i "pandas.Period.hour ES01" \
242208
-i "pandas.Period.is_leap_year ES01" \
243209
-i "pandas.Period.minute ES01" \
244210
-i "pandas.Period.month ES01" \
245211
-i "pandas.Period.quarter ES01" \
246212
-i "pandas.Period.second ES01" \
247-
-i "pandas.Period.start_time ES01" \
248213
-i "pandas.Period.week ES01" \
249214
-i "pandas.Period.weekofyear ES01" \
250215
-i "pandas.Period.asfreq ES01" \
@@ -380,47 +345,17 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
380345
-i "pandas.MultiIndex.truncate ES01" \
381346
-i "pandas.MultiIndex.get_locs ES01" \
382347
-i "pandas.IndexSlice ES01" \
383-
-i "pandas.DatetimeIndex.year ES01" \
384-
-i "pandas.DatetimeIndex.month ES01" \
385-
-i "pandas.DatetimeIndex.day ES01" \
386-
-i "pandas.DatetimeIndex.hour ES01" \
387-
-i "pandas.DatetimeIndex.minute ES01" \
388-
-i "pandas.DatetimeIndex.second ES01" \
389-
-i "pandas.DatetimeIndex.microsecond ES01" \
390-
-i "pandas.DatetimeIndex.nanosecond ES01" \
391-
-i "pandas.DatetimeIndex.dayofyear ES01" \
392-
-i "pandas.DatetimeIndex.day_of_year ES01" \
393-
-i "pandas.DatetimeIndex.quarter ES01" \
394-
-i "pandas.DatetimeIndex.tz ES01" \
395348
-i "pandas.DatetimeIndex.freqstr ES01" \
396-
-i "pandas.DatetimeIndex.is_month_start ES01" \
397-
-i "pandas.DatetimeIndex.is_month_end ES01" \
398-
-i "pandas.DatetimeIndex.is_quarter_start ES01" \
399-
-i "pandas.DatetimeIndex.is_quarter_end ES01" \
400-
-i "pandas.DatetimeIndex.is_year_start ES01" \
401-
-i "pandas.DatetimeIndex.is_year_end ES01" \
402349
-i "pandas.DatetimeIndex.inferred_freq ES01" \
403350
-i "pandas.DatetimeIndex.indexer_at_time ES01" \
404351
-i "pandas.DatetimeIndex.indexer_between_time ES01" \
405352
-i "pandas.DatetimeIndex.snap ES01" \
406353
-i "pandas.DatetimeIndex.tz_convert ES01" \
407-
-i "pandas.DatetimeIndex.round ES01" \
408-
-i "pandas.DatetimeIndex.floor ES01" \
409-
-i "pandas.DatetimeIndex.ceil ES01" \
410-
-i "pandas.DatetimeIndex.month_name ES01" \
411-
-i "pandas.DatetimeIndex.day_name ES01" \
412354
-i "pandas.DatetimeIndex.to_pydatetime ES01" \
413355
-i "pandas.DatetimeIndex.to_frame ES01" \
414356
-i "pandas.DatetimeIndex.mean ES01" \
415-
-i "pandas.TimedeltaIndex.days ES01" \
416-
-i "pandas.TimedeltaIndex.seconds ES01" \
417-
-i "pandas.TimedeltaIndex.microseconds ES01" \
418-
-i "pandas.TimedeltaIndex.nanoseconds ES01" \
419357
-i "pandas.TimedeltaIndex.inferred_freq ES01" \
420358
-i "pandas.TimedeltaIndex.to_pytimedelta ES01" \
421-
-i "pandas.TimedeltaIndex.round ES01" \
422-
-i "pandas.TimedeltaIndex.floor ES01" \
423-
-i "pandas.TimedeltaIndex.ceil ES01" \
424359
-i "pandas.TimedeltaIndex.to_frame ES01" \
425360
-i "pandas.TimedeltaIndex.mean ES01" \
426361
-i "pandas.PeriodIndex.day ES01" \
@@ -430,15 +365,13 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
430365
-i "pandas.PeriodIndex.day_of_year ES01" \
431366
-i "pandas.PeriodIndex.days_in_month ES01" \
432367
-i "pandas.PeriodIndex.daysinmonth ES01" \
433-
-i "pandas.PeriodIndex.end_time ES01" \
434368
-i "pandas.PeriodIndex.freqstr ES01" \
435369
-i "pandas.PeriodIndex.hour ES01" \
436370
-i "pandas.PeriodIndex.is_leap_year ES01" \
437371
-i "pandas.PeriodIndex.minute ES01" \
438372
-i "pandas.PeriodIndex.month ES01" \
439373
-i "pandas.PeriodIndex.quarter ES01" \
440374
-i "pandas.PeriodIndex.second ES01" \
441-
-i "pandas.PeriodIndex.start_time ES01" \
442375
-i "pandas.PeriodIndex.week ES01" \
443376
-i "pandas.PeriodIndex.weekday ES01" \
444377
-i "pandas.PeriodIndex.weekofyear ES01" \

pandas/_libs/tslibs/period.pyx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1667,6 +1667,10 @@ cdef class PeriodMixin:
16671667
"""
16681668
Get the Timestamp for the start of the period.
16691669

1670+
This property returns the exact start time of the period as a Timestamp.
1671+
For example, a monthly period starting in January 2020 would return
1672+
a Timestamp of '2020-01-01 00:00:00'.
1673+
16701674
Returns
16711675
-------
16721676
Timestamp
@@ -1697,6 +1701,10 @@ cdef class PeriodMixin:
16971701
"""
16981702
Get the Timestamp for the end of the period.
16991703

1704+
This property returns the exact end time of the period as a Timestamp.
1705+
The returned timestamp represents the last possible moment within the
1706+
period (e.g., 23:59:59.999999 for a daily period).
1707+
17001708
Returns
17011709
-------
17021710
Timestamp

pandas/core/arrays/datetimelike.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2125,6 +2125,10 @@ def round(
21252125
"""
21262126
Perform round operation on the data to the specified `freq`.
21272127
2128+
This method rounds each datetime value in the Series/Index to the
2129+
nearest specified frequency using standard rounding rules (round half
2130+
to even).
2131+
21282132
Parameters
21292133
----------
21302134
freq : str or Offset
@@ -2229,6 +2233,9 @@ def floor(
22292233
"""
22302234
Perform floor operation on the data to the specified `freq`.
22312235
2236+
This method rounds each datetime value in the Series/Index down to
2237+
the specified frequency (i.e., towards negative infinity).
2238+
22322239
Parameters
22332240
----------
22342241
freq : str or Offset
@@ -2333,6 +2340,9 @@ def ceil(
23332340
"""
23342341
Perform ceil operation on the data to the specified `freq`.
23352342
2343+
This method rounds each datetime value in the Series/Index up to
2344+
the specified frequency (i.e., towards positive infinity).
2345+
23362346
Parameters
23372347
----------
23382348
freq : str or Offset

pandas/core/arrays/datetimes.py

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -595,6 +595,10 @@ def tz(self) -> tzinfo | None:
595595
"""
596596
Return the timezone.
597597
598+
This property returns the timezone information associated with the
599+
datetime data. If the data is timezone-naive (i.e. has no timezone
600+
information), it returns None.
601+
598602
Returns
599603
-------
600604
zoneinfo.ZoneInfo,, datetime.tzinfo, pytz.tzinfo.BaseTZInfo, dateutil.tz.tz.tzfile, or None
@@ -861,6 +865,10 @@ def tz_convert(self, tz) -> Self:
861865
"""
862866
Convert tz-aware Datetime Array/Index from one time zone to another.
863867
868+
This method converts datetime values from their current timezone to a
869+
different timezone. The underlying UTC time remains the same, only the
870+
local time representation changes to reflect the target timezone.
871+
864872
Parameters
865873
----------
866874
tz : str, zoneinfo.ZoneInfo, pytz.timezone, dateutil.tz.tzfile, datetime.tzinfo or None
@@ -1288,6 +1296,10 @@ def month_name(self, locale=None) -> npt.NDArray[np.object_]:
12881296
"""
12891297
Return the month names with specified locale.
12901298
1299+
This method returns the full name of the month (e.g., "January", "February")
1300+
for each datetime value in the Series/Index. The names can be localized
1301+
to different languages using the locale parameter.
1302+
12911303
Parameters
12921304
----------
12931305
locale : str, optional
@@ -1356,6 +1368,10 @@ def day_name(self, locale=None) -> npt.NDArray[np.object_]:
13561368
"""
13571369
Return the day names with specified locale.
13581370
1371+
This method returns the full name of the day of the week (e.g., "Monday",
1372+
"Tuesday") for each datetime value in the Series/Index. The names can be
1373+
localized to different languages using the locale parameter.
1374+
13591375
Parameters
13601376
----------
13611377
locale : str, optional
@@ -1555,6 +1571,10 @@ def isocalendar(self) -> DataFrame:
15551571
"""
15561572
Calculate year, week, and day according to the ISO 8601 standard.
15571573
1574+
The ISO 8601 standard defines the first week of the year as the week
1575+
containing the first Thursday. This method returns a DataFrame with
1576+
columns for the ISO year, ISO week number, and ISO day of week.
1577+
15581578
Returns
15591579
-------
15601580
DataFrame
@@ -1600,6 +1620,10 @@ def isocalendar(self) -> DataFrame:
16001620
"""
16011621
The year of the datetime.
16021622
1623+
This attribute returns the year component of each datetime value
1624+
in the Series/Index. The returned values are integers representing
1625+
the calendar year.
1626+
16031627
See Also
16041628
--------
16051629
DatetimeIndex.month: The month as January=1, December=12.
@@ -1628,6 +1652,10 @@ def isocalendar(self) -> DataFrame:
16281652
"""
16291653
The month as January=1, December=12.
16301654
1655+
This attribute returns the month component of each datetime value
1656+
in the Series/Index. Months are numbered from 1 (January) through
1657+
12 (December).
1658+
16311659
See Also
16321660
--------
16331661
DatetimeIndex.year: The year of the datetime.
@@ -1656,6 +1684,10 @@ def isocalendar(self) -> DataFrame:
16561684
"""
16571685
The day of the datetime.
16581686
1687+
This attribute returns the day of the month component of each
1688+
datetime value in the Series/Index. Values range from 1 to 31,
1689+
depending on the month.
1690+
16591691
See Also
16601692
--------
16611693
DatetimeIndex.year: The year of the datetime.
@@ -1685,6 +1717,10 @@ def isocalendar(self) -> DataFrame:
16851717
"""
16861718
The hours of the datetime.
16871719
1720+
This attribute returns the hour component of each datetime value
1721+
in the Series/Index. Values range from 0 to 23, representing the
1722+
hour of the day in 24-hour format.
1723+
16881724
See Also
16891725
--------
16901726
DatetimeIndex.day: The day of the datetime.
@@ -1714,6 +1750,9 @@ def isocalendar(self) -> DataFrame:
17141750
"""
17151751
The minutes of the datetime.
17161752
1753+
This attribute returns the minute component of each datetime value
1754+
in the Series/Index. Values range from 0 to 59.
1755+
17171756
See Also
17181757
--------
17191758
DatetimeIndex.hour: The hours of the datetime.
@@ -1742,6 +1781,9 @@ def isocalendar(self) -> DataFrame:
17421781
"""
17431782
The seconds of the datetime.
17441783
1784+
This attribute returns the second component of each datetime value
1785+
in the Series/Index. Values range from 0 to 59.
1786+
17451787
See Also
17461788
--------
17471789
DatetimeIndex.minute: The minutes of the datetime.
@@ -1771,6 +1813,10 @@ def isocalendar(self) -> DataFrame:
17711813
"""
17721814
The microseconds of the datetime.
17731815
1816+
This attribute returns the microsecond component of each datetime
1817+
value in the Series/Index. Values range from 0 to 999999
1818+
(one microsecond is one millionth of a second).
1819+
17741820
See Also
17751821
--------
17761822
DatetimeIndex.second: The seconds of the datetime.
@@ -1799,6 +1845,10 @@ def isocalendar(self) -> DataFrame:
17991845
"""
18001846
The nanoseconds of the datetime.
18011847
1848+
This attribute returns the nanosecond component of each datetime
1849+
value in the Series/Index. Values range from 0 to 999
1850+
(one nanosecond is one billionth of a second).
1851+
18021852
See Also
18031853
--------
18041854
DatetimeIndex.second: The seconds of the datetime.
@@ -1865,6 +1915,9 @@ def isocalendar(self) -> DataFrame:
18651915
"""
18661916
The ordinal day of the year.
18671917
1918+
This attribute returns the day of the year for each datetime value
1919+
in the Series/Index. Values range from 1 to 365 (or 366 for leap years).
1920+
18681921
See Also
18691922
--------
18701923
DatetimeIndex.dayofweek : The day of the week with Monday=0, Sunday=6.
@@ -1900,6 +1953,11 @@ def isocalendar(self) -> DataFrame:
19001953
"""
19011954
The quarter of the date.
19021955
1956+
This attribute returns the quarter of the year for each datetime value
1957+
in the Series/Index. Quarter 1 includes January through March, quarter 2
1958+
includes April through June, quarter 3 includes July through September,
1959+
and quarter 4 includes October through December.
1960+
19031961
See Also
19041962
--------
19051963
DatetimeIndex.snap : Snap time stamps to nearest occurring frequency.
@@ -1935,6 +1993,10 @@ def isocalendar(self) -> DataFrame:
19351993
"""
19361994
The number of days in the month.
19371995
1996+
This attribute returns the total number of days in the month for each
1997+
datetime value in the Series/Index. The value depends on the month and
1998+
whether the year is a leap year (e.g., February has 29 days in a leap year).
1999+
19382000
See Also
19392001
--------
19402002
Series.dt.day : Return the day of the month.
@@ -1962,6 +2024,9 @@ def isocalendar(self) -> DataFrame:
19622024
_is_month_doc = """
19632025
Indicates whether the date is the {first_or_last} day of the month.
19642026
2027+
This boolean attribute evaluates to True if the date falls on the
2028+
{first_or_last} day of a calendar month, and False otherwise.
2029+
19652030
Returns
19662031
-------
19672032
Series or array
@@ -2017,6 +2082,10 @@ def isocalendar(self) -> DataFrame:
20172082
"""
20182083
Indicator for whether the date is the first day of a quarter.
20192084
2085+
This boolean attribute evaluates to True if the date falls on the
2086+
first day of a calendar quarter (January 1, April 1, July 1, or
2087+
October 1), and False otherwise.
2088+
20202089
Returns
20212090
-------
20222091
is_quarter_start : Series or DatetimeIndex
@@ -2059,6 +2128,10 @@ def isocalendar(self) -> DataFrame:
20592128
"""
20602129
Indicator for whether the date is the last day of a quarter.
20612130
2131+
This boolean attribute evaluates to True if the date falls on the
2132+
last day of a calendar quarter (March 31, June 30, September 30, or
2133+
December 31), and False otherwise.
2134+
20622135
Returns
20632136
-------
20642137
is_quarter_end : Series or DatetimeIndex
@@ -2101,6 +2174,9 @@ def isocalendar(self) -> DataFrame:
21012174
"""
21022175
Indicate whether the date is the first day of a year.
21032176
2177+
This boolean attribute evaluates to True if the date is January 1st,
2178+
and False otherwise.
2179+
21042180
Returns
21052181
-------
21062182
Series or DatetimeIndex
@@ -2171,6 +2247,9 @@ def isocalendar(self) -> DataFrame:
21712247
"""
21722248
Indicate whether the date is the last day of the year.
21732249
2250+
This boolean attribute evaluates to True if the date is December 31st,
2251+
and False otherwise.
2252+
21742253
Returns
21752254
-------
21762255
Series or DatetimeIndex

0 commit comments

Comments
 (0)