Skip to content

Commit 9fa6024

Browse files
committed
Merge branch 'main' into ref-stringarray-pyarrow-1
2 parents d323ec3 + 6423ee8 commit 9fa6024

File tree

7 files changed

+117
-60
lines changed

7 files changed

+117
-60
lines changed

ci/code_checks.sh

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
221221
-i "pandas.Timestamp.today SA01" \
222222
-i "pandas.Timestamp.toordinal SA01" \
223223
-i "pandas.Timestamp.tzinfo GL08" \
224-
-i "pandas.Timestamp.unit SA01" \
225-
-i "pandas.Timestamp.utcoffset SA01" \
226-
-i "pandas.Timestamp.utctimetuple SA01" \
227224
-i "pandas.Timestamp.value GL08" \
228225
-i "pandas.Timestamp.year GL08" \
229226
-i "pandas.api.extensions.ExtensionArray._pad_or_backfill PR01,RT03,SA01" \
@@ -409,7 +406,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
409406
-i "pandas.set_eng_float_format RT03,SA01" \
410407
-i "pandas.testing.assert_extension_array_equal SA01" \
411408
-i "pandas.tseries.offsets.BDay PR02,SA01" \
412-
-i "pandas.tseries.offsets.BQuarterBegin PR02" \
413409
-i "pandas.tseries.offsets.BQuarterBegin.freqstr SA01" \
414410
-i "pandas.tseries.offsets.BQuarterBegin.is_on_offset GL08" \
415411
-i "pandas.tseries.offsets.BQuarterBegin.n GL08" \
@@ -431,7 +427,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
431427
-i "pandas.tseries.offsets.BYearBegin.nanos GL08" \
432428
-i "pandas.tseries.offsets.BYearBegin.normalize GL08" \
433429
-i "pandas.tseries.offsets.BYearBegin.rule_code GL08" \
434-
-i "pandas.tseries.offsets.BYearEnd PR02" \
435430
-i "pandas.tseries.offsets.BYearEnd.freqstr SA01" \
436431
-i "pandas.tseries.offsets.BYearEnd.is_on_offset GL08" \
437432
-i "pandas.tseries.offsets.BYearEnd.month GL08" \
@@ -520,7 +515,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
520515
-i "pandas.tseries.offsets.CustomBusinessMonthEnd.normalize GL08" \
521516
-i "pandas.tseries.offsets.CustomBusinessMonthEnd.rule_code GL08" \
522517
-i "pandas.tseries.offsets.CustomBusinessMonthEnd.weekmask GL08" \
523-
-i "pandas.tseries.offsets.DateOffset PR02" \
524518
-i "pandas.tseries.offsets.DateOffset.freqstr SA01" \
525519
-i "pandas.tseries.offsets.DateOffset.is_on_offset GL08" \
526520
-i "pandas.tseries.offsets.DateOffset.n GL08" \
@@ -533,14 +527,12 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
533527
-i "pandas.tseries.offsets.Day.nanos SA01" \
534528
-i "pandas.tseries.offsets.Day.normalize GL08" \
535529
-i "pandas.tseries.offsets.Day.rule_code GL08" \
536-
-i "pandas.tseries.offsets.Easter PR02" \
537530
-i "pandas.tseries.offsets.Easter.freqstr SA01" \
538531
-i "pandas.tseries.offsets.Easter.is_on_offset GL08" \
539532
-i "pandas.tseries.offsets.Easter.n GL08" \
540533
-i "pandas.tseries.offsets.Easter.nanos GL08" \
541534
-i "pandas.tseries.offsets.Easter.normalize GL08" \
542535
-i "pandas.tseries.offsets.Easter.rule_code GL08" \
543-
-i "pandas.tseries.offsets.FY5253 PR02" \
544536
-i "pandas.tseries.offsets.FY5253.freqstr SA01" \
545537
-i "pandas.tseries.offsets.FY5253.get_rule_code_suffix GL08" \
546538
-i "pandas.tseries.offsets.FY5253.get_year_end GL08" \
@@ -552,7 +544,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
552544
-i "pandas.tseries.offsets.FY5253.startingMonth GL08" \
553545
-i "pandas.tseries.offsets.FY5253.variation GL08" \
554546
-i "pandas.tseries.offsets.FY5253.weekday GL08" \
555-
-i "pandas.tseries.offsets.FY5253Quarter PR02" \
556547
-i "pandas.tseries.offsets.FY5253Quarter.freqstr SA01" \
557548
-i "pandas.tseries.offsets.FY5253Quarter.get_rule_code_suffix GL08" \
558549
-i "pandas.tseries.offsets.FY5253Quarter.get_weeks GL08" \
@@ -566,14 +557,13 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
566557
-i "pandas.tseries.offsets.FY5253Quarter.variation GL08" \
567558
-i "pandas.tseries.offsets.FY5253Quarter.weekday GL08" \
568559
-i "pandas.tseries.offsets.FY5253Quarter.year_has_extra_week GL08" \
569-
-i "pandas.tseries.offsets.Hour PR02" \
570560
-i "pandas.tseries.offsets.Hour.freqstr SA01" \
571561
-i "pandas.tseries.offsets.Hour.is_on_offset GL08" \
572562
-i "pandas.tseries.offsets.Hour.n GL08" \
573563
-i "pandas.tseries.offsets.Hour.nanos SA01" \
574564
-i "pandas.tseries.offsets.Hour.normalize GL08" \
575565
-i "pandas.tseries.offsets.Hour.rule_code GL08" \
576-
-i "pandas.tseries.offsets.LastWeekOfMonth PR02,SA01" \
566+
-i "pandas.tseries.offsets.LastWeekOfMonth SA01" \
577567
-i "pandas.tseries.offsets.LastWeekOfMonth.freqstr SA01" \
578568
-i "pandas.tseries.offsets.LastWeekOfMonth.is_on_offset GL08" \
579569
-i "pandas.tseries.offsets.LastWeekOfMonth.n GL08" \
@@ -582,28 +572,24 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
582572
-i "pandas.tseries.offsets.LastWeekOfMonth.rule_code GL08" \
583573
-i "pandas.tseries.offsets.LastWeekOfMonth.week GL08" \
584574
-i "pandas.tseries.offsets.LastWeekOfMonth.weekday GL08" \
585-
-i "pandas.tseries.offsets.Micro PR02" \
586575
-i "pandas.tseries.offsets.Micro.freqstr SA01" \
587576
-i "pandas.tseries.offsets.Micro.is_on_offset GL08" \
588577
-i "pandas.tseries.offsets.Micro.n GL08" \
589578
-i "pandas.tseries.offsets.Micro.nanos SA01" \
590579
-i "pandas.tseries.offsets.Micro.normalize GL08" \
591580
-i "pandas.tseries.offsets.Micro.rule_code GL08" \
592-
-i "pandas.tseries.offsets.Milli PR02" \
593581
-i "pandas.tseries.offsets.Milli.freqstr SA01" \
594582
-i "pandas.tseries.offsets.Milli.is_on_offset GL08" \
595583
-i "pandas.tseries.offsets.Milli.n GL08" \
596584
-i "pandas.tseries.offsets.Milli.nanos SA01" \
597585
-i "pandas.tseries.offsets.Milli.normalize GL08" \
598586
-i "pandas.tseries.offsets.Milli.rule_code GL08" \
599-
-i "pandas.tseries.offsets.Minute PR02" \
600587
-i "pandas.tseries.offsets.Minute.freqstr SA01" \
601588
-i "pandas.tseries.offsets.Minute.is_on_offset GL08" \
602589
-i "pandas.tseries.offsets.Minute.n GL08" \
603590
-i "pandas.tseries.offsets.Minute.nanos SA01" \
604591
-i "pandas.tseries.offsets.Minute.normalize GL08" \
605592
-i "pandas.tseries.offsets.Minute.rule_code GL08" \
606-
-i "pandas.tseries.offsets.MonthBegin PR02" \
607593
-i "pandas.tseries.offsets.MonthBegin.freqstr SA01" \
608594
-i "pandas.tseries.offsets.MonthBegin.is_on_offset GL08" \
609595
-i "pandas.tseries.offsets.MonthBegin.n GL08" \
@@ -616,14 +602,12 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
616602
-i "pandas.tseries.offsets.MonthEnd.nanos GL08" \
617603
-i "pandas.tseries.offsets.MonthEnd.normalize GL08" \
618604
-i "pandas.tseries.offsets.MonthEnd.rule_code GL08" \
619-
-i "pandas.tseries.offsets.Nano PR02" \
620605
-i "pandas.tseries.offsets.Nano.freqstr SA01" \
621606
-i "pandas.tseries.offsets.Nano.is_on_offset GL08" \
622607
-i "pandas.tseries.offsets.Nano.n GL08" \
623608
-i "pandas.tseries.offsets.Nano.nanos SA01" \
624609
-i "pandas.tseries.offsets.Nano.normalize GL08" \
625610
-i "pandas.tseries.offsets.Nano.rule_code GL08" \
626-
-i "pandas.tseries.offsets.QuarterBegin PR02" \
627611
-i "pandas.tseries.offsets.QuarterBegin.freqstr SA01" \
628612
-i "pandas.tseries.offsets.QuarterBegin.is_on_offset GL08" \
629613
-i "pandas.tseries.offsets.QuarterBegin.n GL08" \
@@ -638,14 +622,13 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
638622
-i "pandas.tseries.offsets.QuarterEnd.normalize GL08" \
639623
-i "pandas.tseries.offsets.QuarterEnd.rule_code GL08" \
640624
-i "pandas.tseries.offsets.QuarterEnd.startingMonth GL08" \
641-
-i "pandas.tseries.offsets.Second PR02" \
642625
-i "pandas.tseries.offsets.Second.freqstr SA01" \
643626
-i "pandas.tseries.offsets.Second.is_on_offset GL08" \
644627
-i "pandas.tseries.offsets.Second.n GL08" \
645628
-i "pandas.tseries.offsets.Second.nanos SA01" \
646629
-i "pandas.tseries.offsets.Second.normalize GL08" \
647630
-i "pandas.tseries.offsets.Second.rule_code GL08" \
648-
-i "pandas.tseries.offsets.SemiMonthBegin PR02,SA01" \
631+
-i "pandas.tseries.offsets.SemiMonthBegin SA01" \
649632
-i "pandas.tseries.offsets.SemiMonthBegin.day_of_month GL08" \
650633
-i "pandas.tseries.offsets.SemiMonthBegin.freqstr SA01" \
651634
-i "pandas.tseries.offsets.SemiMonthBegin.is_on_offset GL08" \
@@ -668,15 +651,14 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
668651
-i "pandas.tseries.offsets.Tick.nanos SA01" \
669652
-i "pandas.tseries.offsets.Tick.normalize GL08" \
670653
-i "pandas.tseries.offsets.Tick.rule_code GL08" \
671-
-i "pandas.tseries.offsets.Week PR02" \
672654
-i "pandas.tseries.offsets.Week.freqstr SA01" \
673655
-i "pandas.tseries.offsets.Week.is_on_offset GL08" \
674656
-i "pandas.tseries.offsets.Week.n GL08" \
675657
-i "pandas.tseries.offsets.Week.nanos GL08" \
676658
-i "pandas.tseries.offsets.Week.normalize GL08" \
677659
-i "pandas.tseries.offsets.Week.rule_code GL08" \
678660
-i "pandas.tseries.offsets.Week.weekday GL08" \
679-
-i "pandas.tseries.offsets.WeekOfMonth PR02,SA01" \
661+
-i "pandas.tseries.offsets.WeekOfMonth SA01" \
680662
-i "pandas.tseries.offsets.WeekOfMonth.freqstr SA01" \
681663
-i "pandas.tseries.offsets.WeekOfMonth.is_on_offset GL08" \
682664
-i "pandas.tseries.offsets.WeekOfMonth.n GL08" \

pandas/_libs/tslibs/nattype.pyx

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,24 @@ class NaTType(_NaT):
595595
utctimetuple = _make_error_func(
596596
"utctimetuple",
597597
"""
598-
Return UTC time tuple, compatible with time.localtime().
598+
Return UTC time tuple, compatible with `time.localtime()`.
599+
600+
This method converts the Timestamp to UTC and returns a time tuple
601+
containing 9 components: year, month, day, hour, minute, second,
602+
weekday, day of year, and DST flag. This is particularly useful for
603+
converting a Timestamp to a format compatible with time module functions.
604+
605+
Returns
606+
-------
607+
time.struct_time
608+
A time.struct_time object representing the UTC time.
609+
610+
See Also
611+
--------
612+
datetime.datetime.utctimetuple :
613+
Return UTC time tuple, compatible with time.localtime().
614+
Timestamp.timetuple : Return time tuple of local time.
615+
time.struct_time : Time tuple structure used by time functions.
599616
600617
Examples
601618
--------
@@ -612,6 +629,22 @@ class NaTType(_NaT):
612629
"""
613630
Return utc offset.
614631
632+
This method returns the difference between UTC and the local time
633+
as a `timedelta` object. It is useful for understanding the time
634+
difference between the current timezone and UTC.
635+
636+
Returns
637+
--------
638+
timedelta
639+
The difference between UTC and the local time as a `timedelta` object.
640+
641+
See Also
642+
--------
643+
datetime.datetime.utcoffset :
644+
Standard library method to get the UTC offset of a datetime object.
645+
Timestamp.tzname : Return the name of the timezone.
646+
Timestamp.dst : Return the daylight saving time (DST) adjustment.
647+
615648
Examples
616649
--------
617650
>>> ts = pd.Timestamp('2023-01-01 10:00:00', tz='Europe/Brussels')

pandas/_libs/tslibs/offsets.pyx

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1147,7 +1147,7 @@ cdef class Hour(Tick):
11471147
"""
11481148
Offset ``n`` hours.
11491149
1150-
Parameters
1150+
Attributes
11511151
----------
11521152
n : int, default 1
11531153
The number of hours represented.
@@ -1183,7 +1183,7 @@ cdef class Minute(Tick):
11831183
"""
11841184
Offset ``n`` minutes.
11851185
1186-
Parameters
1186+
Attributes
11871187
----------
11881188
n : int, default 1
11891189
The number of minutes represented.
@@ -1219,7 +1219,7 @@ cdef class Second(Tick):
12191219
"""
12201220
Offset ``n`` seconds.
12211221
1222-
Parameters
1222+
Attributes
12231223
----------
12241224
n : int, default 1
12251225
The number of seconds represented.
@@ -1255,7 +1255,7 @@ cdef class Milli(Tick):
12551255
"""
12561256
Offset ``n`` milliseconds.
12571257
1258-
Parameters
1258+
Attributes
12591259
----------
12601260
n : int, default 1
12611261
The number of milliseconds represented.
@@ -1292,7 +1292,7 @@ cdef class Micro(Tick):
12921292
"""
12931293
Offset ``n`` microseconds.
12941294
1295-
Parameters
1295+
Attributes
12961296
----------
12971297
n : int, default 1
12981298
The number of microseconds represented.
@@ -1329,7 +1329,7 @@ cdef class Nano(Tick):
13291329
"""
13301330
Offset ``n`` nanoseconds.
13311331
1332-
Parameters
1332+
Attributes
13331333
----------
13341334
n : int, default 1
13351335
The number of nanoseconds represented.
@@ -1616,7 +1616,7 @@ class DateOffset(RelativeDeltaOffset, metaclass=OffsetMeta):
16161616
Besides, adding a DateOffsets specified by the singular form of the date
16171617
component can be used to replace certain component of the timestamp.
16181618
1619-
Parameters
1619+
Attributes
16201620
----------
16211621
n : int, default 1
16221622
The number of time periods the offset represents.
@@ -2506,7 +2506,7 @@ cdef class BYearEnd(YearOffset):
25062506
"""
25072507
DateOffset increments between the last business day of the year.
25082508
2509-
Parameters
2509+
Attributes
25102510
----------
25112511
n : int, default 1
25122512
The number of years represented.
@@ -2804,7 +2804,7 @@ cdef class BQuarterBegin(QuarterOffset):
28042804
startingMonth = 2 corresponds to dates like 2/01/2007, 5/01/2007, ...
28052805
startingMonth = 3 corresponds to dates like 3/01/2007, 6/01/2007, ...
28062806
2807-
Parameters
2807+
Attributes
28082808
----------
28092809
n : int, default 1
28102810
The number of quarters represented.
@@ -2886,7 +2886,7 @@ cdef class QuarterBegin(QuarterOffset):
28862886
startingMonth = 2 corresponds to dates like 2/01/2007, 5/01/2007, ...
28872887
startingMonth = 3 corresponds to dates like 3/01/2007, 6/01/2007, ...
28882888
2889-
Parameters
2889+
Attributes
28902890
----------
28912891
n : int, default 1
28922892
The number of quarters represented.
@@ -2984,7 +2984,7 @@ cdef class MonthBegin(MonthOffset):
29842984
29852985
MonthBegin goes to the next date which is a start of the month.
29862986
2987-
Parameters
2987+
Attributes
29882988
----------
29892989
n : int, default 1
29902990
The number of months represented.
@@ -3272,7 +3272,7 @@ cdef class SemiMonthBegin(SemiMonthOffset):
32723272
"""
32733273
Two DateOffset's per month repeating on the first day of the month & day_of_month.
32743274
3275-
Parameters
3275+
Attributes
32763276
----------
32773277
n : int, default 1
32783278
The number of months represented.
@@ -3304,7 +3304,7 @@ cdef class Week(SingleConstructorOffset):
33043304
"""
33053305
Weekly offset.
33063306
3307-
Parameters
3307+
Attributes
33083308
----------
33093309
n : int, default 1
33103310
The number of weeks represented.
@@ -3477,7 +3477,7 @@ cdef class WeekOfMonth(WeekOfMonthMixin):
34773477
"""
34783478
Describes monthly dates like "the Tuesday of the 2nd week of each month".
34793479
3480-
Parameters
3480+
Attributes
34813481
----------
34823482
n : int, default 1
34833483
The number of months represented.
@@ -3554,7 +3554,7 @@ cdef class LastWeekOfMonth(WeekOfMonthMixin):
35543554
35553555
For example "the last Tuesday of each month".
35563556
3557-
Parameters
3557+
Attributes
35583558
----------
35593559
n : int, default 1
35603560
The number of months represented.
@@ -3694,7 +3694,7 @@ cdef class FY5253(FY5253Mixin):
36943694
X is a specific day of the week.
36953695
Y is a certain month of the year
36963696
3697-
Parameters
3697+
Attributes
36983698
----------
36993699
n : int
37003700
The number of fiscal years represented.
@@ -3897,7 +3897,7 @@ cdef class FY5253Quarter(FY5253Mixin):
38973897
startingMonth = 2 corresponds to dates like 2/28/2007, 5/31/2007, ...
38983898
startingMonth = 3 corresponds to dates like 3/30/2007, 6/29/2007, ...
38993899
3900-
Parameters
3900+
Attributes
39013901
----------
39023902
n : int
39033903
The number of business quarters represented.
@@ -4132,7 +4132,7 @@ cdef class Easter(SingleConstructorOffset):
41324132
41334133
Right now uses the revised method which is valid in years 1583-4099.
41344134
4135-
Parameters
4135+
Attributes
41364136
----------
41374137
n : int, default 1
41384138
The number of years represented.

0 commit comments

Comments
 (0)