Skip to content

Commit 6dd0c4e

Browse files
Add ss02 (#37559)
1 parent e534b10 commit 6dd0c4e

File tree

3 files changed

+45
-13
lines changed

3 files changed

+45
-13
lines changed

ci/code_checks.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,8 @@ fi
225225
### DOCSTRINGS ###
226226
if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
227227

228-
MSG='Validate docstrings (GL03, GL04, GL05, GL06, GL07, GL09, GL10, SS04, SS05, PR03, PR04, PR05, PR10, EX04, RT01, RT04, RT05, SA02, SA03)' ; echo $MSG
229-
$BASE_DIR/scripts/validate_docstrings.py --format=actions --errors=GL03,GL04,GL05,GL06,GL07,GL09,GL10,SS04,SS05,PR03,PR04,PR05,PR10,EX04,RT01,RT04,RT05,SA02,SA03
228+
MSG='Validate docstrings (GL03, GL04, GL05, GL06, GL07, GL09, GL10, SS02, SS04, SS05, PR03, PR04, PR05, PR10, EX04, RT01, RT04, RT05, SA02, SA03)' ; echo $MSG
229+
$BASE_DIR/scripts/validate_docstrings.py --format=actions --errors=GL03,GL04,GL05,GL06,GL07,GL09,GL10,SS02,SS04,SS05,PR03,PR04,PR05,PR10,EX04,RT01,RT04,RT05,SA02,SA03
230230
RET=$(($RET + $?)) ; echo $MSG "DONE"
231231

232232
MSG='Validate correct capitalization among titles in documentation' ; echo $MSG

pandas/_libs/tslibs/nattype.pyx

+22-6
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,6 @@ class NaTType(_NaT):
418418
utctimetuple = _make_error_func("utctimetuple", datetime)
419419
timetz = _make_error_func("timetz", datetime)
420420
timetuple = _make_error_func("timetuple", datetime)
421-
strftime = _make_error_func("strftime", datetime)
422421
isocalendar = _make_error_func("isocalendar", datetime)
423422
dst = _make_error_func("dst", datetime)
424423
ctime = _make_error_func("ctime", datetime)
@@ -435,6 +434,23 @@ class NaTType(_NaT):
435434
# The remaining methods have docstrings copy/pasted from the analogous
436435
# Timestamp methods.
437436

437+
strftime = _make_error_func(
438+
"strftime",
439+
"""
440+
Timestamp.strftime(format)
441+
442+
Return a string representing the given POSIX timestamp
443+
controlled by an explicit format string.
444+
445+
Parameters
446+
----------
447+
format : str
448+
Format string to convert Timestamp to string.
449+
See strftime documentation for more information on the format string:
450+
https://docs.python.org/3/library/datetime.html#strftime-and-strptime-behavior.
451+
""",
452+
)
453+
438454
strptime = _make_error_func(
439455
"strptime",
440456
"""
@@ -457,15 +473,15 @@ class NaTType(_NaT):
457473
"""
458474
Timestamp.fromtimestamp(ts)
459475
460-
timestamp[, tz] -> tz's local time from POSIX timestamp.
476+
Transform timestamp[, tz] to tz's local time from POSIX timestamp.
461477
""",
462478
)
463479
combine = _make_error_func(
464480
"combine",
465481
"""
466482
Timestamp.combine(date, time)
467483
468-
date, time -> datetime with same date and time fields.
484+
Combine date, time into datetime with same date and time fields.
469485
""",
470486
)
471487
utcnow = _make_error_func(
@@ -606,7 +622,7 @@ timedelta}, default 'raise'
606622
floor = _make_nat_func(
607623
"floor",
608624
"""
609-
return a new Timestamp floored to this resolution.
625+
Return a new Timestamp floored to this resolution.
610626
611627
Parameters
612628
----------
@@ -645,7 +661,7 @@ timedelta}, default 'raise'
645661
ceil = _make_nat_func(
646662
"ceil",
647663
"""
648-
return a new Timestamp ceiled to this resolution.
664+
Return a new Timestamp ceiled to this resolution.
649665
650666
Parameters
651667
----------
@@ -761,7 +777,7 @@ default 'raise'
761777
replace = _make_nat_func(
762778
"replace",
763779
"""
764-
implements datetime.replace, handles nanoseconds.
780+
Implements datetime.replace, handles nanoseconds.
765781
766782
Parameters
767783
----------

pandas/_libs/tslibs/timestamps.pyx

+21-5
Original file line numberDiff line numberDiff line change
@@ -912,10 +912,26 @@ class Timestamp(_Timestamp):
912912
"""
913913
Timestamp.fromtimestamp(ts)
914914
915-
timestamp[, tz] -> tz's local time from POSIX timestamp.
915+
Transform timestamp[, tz] to tz's local time from POSIX timestamp.
916916
"""
917917
return cls(datetime.fromtimestamp(ts))
918918

919+
def strftime(self, format):
920+
"""
921+
Timestamp.strftime(format)
922+
923+
Return a string representing the given POSIX timestamp
924+
controlled by an explicit format string.
925+
926+
Parameters
927+
----------
928+
format : str
929+
Format string to convert Timestamp to string.
930+
See strftime documentation for more information on the format string:
931+
https://docs.python.org/3/library/datetime.html#strftime-and-strptime-behavior.
932+
"""
933+
return datetime.strftime(self, format)
934+
919935
# Issue 25016.
920936
@classmethod
921937
def strptime(cls, date_string, format):
@@ -934,7 +950,7 @@ class Timestamp(_Timestamp):
934950
"""
935951
Timestamp.combine(date, time)
936952
937-
date, time -> datetime with same date and time fields.
953+
Combine date, time into datetime with same date and time fields.
938954
"""
939955
return cls(datetime.combine(date, time))
940956

@@ -1153,7 +1169,7 @@ timedelta}, default 'raise'
11531169

11541170
def floor(self, freq, ambiguous='raise', nonexistent='raise'):
11551171
"""
1156-
return a new Timestamp floored to this resolution.
1172+
Return a new Timestamp floored to this resolution.
11571173
11581174
Parameters
11591175
----------
@@ -1192,7 +1208,7 @@ timedelta}, default 'raise'
11921208

11931209
def ceil(self, freq, ambiguous='raise', nonexistent='raise'):
11941210
"""
1195-
return a new Timestamp ceiled to this resolution.
1211+
Return a new Timestamp ceiled to this resolution.
11961212
11971213
Parameters
11981214
----------
@@ -1377,7 +1393,7 @@ default 'raise'
13771393
fold=None,
13781394
):
13791395
"""
1380-
implements datetime.replace, handles nanoseconds.
1396+
Implements datetime.replace, handles nanoseconds.
13811397
13821398
Parameters
13831399
----------

0 commit comments

Comments
 (0)