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" \ 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. diff --git a/pandas/_libs/tslibs/timestamps.pyx b/pandas/_libs/tslibs/timestamps.pyx index 369184d9df40c..35d2f79c39c93 100644 --- a/pandas/_libs/tslibs/timestamps.pyx +++ b/pandas/_libs/tslibs/timestamps.pyx @@ -1449,6 +1449,12 @@ 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. + 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. @@ -1588,6 +1594,18 @@ 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. + + See Also + -------- + datetime.datetime.fromtimestamp : Standard library function to convert a timestamp to a datetime object. + Examples -------- >>> pd.Timestamp.fromtimestamp(1584199972) # doctest: +SKIP