From 830c8eae202edbcc55427f8abe1e06ec2f33c274 Mon Sep 17 00:00:00 2001 From: znarfm <44516102+znarfm@users.noreply.github.com> Date: Sat, 10 Aug 2024 22:03:16 +0800 Subject: [PATCH 1/6] add See Also for Timestamp.fromordinal --- pandas/_libs/tslibs/timestamps.pyx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pandas/_libs/tslibs/timestamps.pyx b/pandas/_libs/tslibs/timestamps.pyx index 369184d9df40c..c65da6993a950 100644 --- a/pandas/_libs/tslibs/timestamps.pyx +++ b/pandas/_libs/tslibs/timestamps.pyx @@ -1449,6 +1449,11 @@ class Timestamp(_Timestamp): tz : str, zoneinfo.ZoneInfo, pytz.timezone, dateutil.tz.tzfile or None Time zone for the Timestamp. + See Also + -------- + Timestamp.fromtimestamp : Create a Timestamp from a POSIX timestamp. + Timestamp.toordinal: Return proleptic Gregorian ordinal. + Notes ----- By definition there cannot be any tz info on the ordinal itself. From 5a6bb582df9fd8f625d62fa82ba5796fd51cfe38 Mon Sep 17 00:00:00 2001 From: znarfm <44516102+znarfm@users.noreply.github.com> Date: Sat, 10 Aug 2024 22:03:57 +0800 Subject: [PATCH 2/6] add Parameters for Timestamp.fromtimestamp --- pandas/_libs/tslibs/timestamps.pyx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pandas/_libs/tslibs/timestamps.pyx b/pandas/_libs/tslibs/timestamps.pyx index c65da6993a950..51bdc00f831b4 100644 --- a/pandas/_libs/tslibs/timestamps.pyx +++ b/pandas/_libs/tslibs/timestamps.pyx @@ -1593,6 +1593,15 @@ class Timestamp(_Timestamp): Transform timestamp[, tz] to tz's local time from POSIX timestamp. + Parameters + ---------- + ts : float + The POSIX timestamp to convert. + tz : str, zoneinfo.ZoneInfo, pytz.timezone, dateutil.tz.tzfile, default None + Time zone for time which Timestamp will be converted to. + If None, uses the system's local timezone. + + Examples -------- >>> pd.Timestamp.fromtimestamp(1584199972) # doctest: +SKIP From 1db00ff4bc2734f5fe840538da2f214ec9f0ce2c Mon Sep 17 00:00:00 2001 From: znarfm <44516102+znarfm@users.noreply.github.com> Date: Sat, 10 Aug 2024 22:12:17 +0800 Subject: [PATCH 3/6] Add See Also for Timestamp.fromtimestamp --- pandas/_libs/tslibs/timestamps.pyx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pandas/_libs/tslibs/timestamps.pyx b/pandas/_libs/tslibs/timestamps.pyx index 51bdc00f831b4..0ea0acfcc3840 100644 --- a/pandas/_libs/tslibs/timestamps.pyx +++ b/pandas/_libs/tslibs/timestamps.pyx @@ -1601,6 +1601,9 @@ class Timestamp(_Timestamp): Time zone for time which Timestamp will be converted to. If None, uses the system's local timezone. + See Also + -------- + datetime.datetime.fromtimestamp : Standard library function to convert a timestamp to a datetime object. Examples -------- From 7d1163e531eca4a0dc52e266bcd36d1a26d764ca Mon Sep 17 00:00:00 2001 From: znarfm <44516102+znarfm@users.noreply.github.com> Date: Sat, 10 Aug 2024 22:15:09 +0800 Subject: [PATCH 4/6] Update See Also for Timestamp.fromordinal --- pandas/_libs/tslibs/timestamps.pyx | 1 + 1 file changed, 1 insertion(+) diff --git a/pandas/_libs/tslibs/timestamps.pyx b/pandas/_libs/tslibs/timestamps.pyx index 0ea0acfcc3840..35d2f79c39c93 100644 --- a/pandas/_libs/tslibs/timestamps.pyx +++ b/pandas/_libs/tslibs/timestamps.pyx @@ -1453,6 +1453,7 @@ class Timestamp(_Timestamp): -------- Timestamp.fromtimestamp : Create a Timestamp from a POSIX timestamp. Timestamp.toordinal: Return proleptic Gregorian ordinal. + datetime.datetime.fromordinal : Standard library function to convert an ordinal to a datetime. Notes ----- From 33874b780bea5216b3b3e39493008ed26d124967 Mon Sep 17 00:00:00 2001 From: znarfm <44516102+znarfm@users.noreply.github.com> Date: Sat, 10 Aug 2024 22:24:44 +0800 Subject: [PATCH 5/6] Removed Timestamp.fromordinal, Timestamp.fromtimestamp --- ci/code_checks.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/ci/code_checks.sh b/ci/code_checks.sh index 540bd59cd5924..512649c24a663 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -206,8 +206,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then -i "pandas.Timestamp.date SA01" \ -i "pandas.Timestamp.day GL08" \ -i "pandas.Timestamp.fold GL08" \ - -i "pandas.Timestamp.fromordinal SA01" \ - -i "pandas.Timestamp.fromtimestamp PR01,SA01" \ -i "pandas.Timestamp.hour GL08" \ -i "pandas.Timestamp.max PR02" \ -i "pandas.Timestamp.microsecond GL08" \ From c24f92d3fac927c4abe0730a403088262fcdf0c8 Mon Sep 17 00:00:00 2001 From: znarfm <44516102+znarfm@users.noreply.github.com> Date: Tue, 20 Aug 2024 21:23:54 +0800 Subject: [PATCH 6/6] fix NaT docstrings --- pandas/_libs/tslibs/nattype.pyx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/pandas/_libs/tslibs/nattype.pyx b/pandas/_libs/tslibs/nattype.pyx index 130e41e5104a2..8cdbbc770c2f8 100644 --- a/pandas/_libs/tslibs/nattype.pyx +++ b/pandas/_libs/tslibs/nattype.pyx @@ -783,6 +783,18 @@ class NaTType(_NaT): Transform timestamp[, tz] to tz's local time from POSIX timestamp. + Parameters + ---------- + ts : float + The POSIX timestamp to convert. + tz : str, zoneinfo.ZoneInfo, pytz.timezone, dateutil.tz.tzfile, default None + Time zone for time which Timestamp will be converted to. + If None, uses the system's local timezone. + + See Also + -------- + datetime.datetime.fromtimestamp : Standard library function to convert a timestamp to a datetime object. + Examples -------- >>> pd.Timestamp.fromtimestamp(1584199972) # doctest: +SKIP @@ -914,6 +926,12 @@ class NaTType(_NaT): tz : str, zoneinfo.ZoneInfo, pytz.timezone, dateutil.tz.tzfile or None Time zone for the Timestamp. + See Also + -------- + Timestamp.fromtimestamp : Create a Timestamp from a POSIX timestamp. + Timestamp.toordinal: Return proleptic Gregorian ordinal. + datetime.datetime.fromordinal : Standard library function to convert an ordinal to a datetime. + Notes ----- By definition there cannot be any tz info on the ordinal itself.