diff --git a/ci/code_checks.sh b/ci/code_checks.sh index 471b79d865566..7509d857d7569 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -187,7 +187,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then pandas.show_versions \ pandas.test \ pandas.NaT \ - pandas.Timestamp.unit \ pandas.Timestamp.as_unit \ pandas.Timestamp.ctime \ pandas.Timestamp.date \ diff --git a/pandas/_libs/tslibs/timestamps.pyx b/pandas/_libs/tslibs/timestamps.pyx index 1a4e90e57d848..fb3adda155254 100644 --- a/pandas/_libs/tslibs/timestamps.pyx +++ b/pandas/_libs/tslibs/timestamps.pyx @@ -236,6 +236,20 @@ cdef class _Timestamp(ABCTimestamp): def unit(self) -> str: """ The abbreviation associated with self._creso. + + Examples + -------- + >>> pd.Timestamp("2020-01-01 12:34:56").unit + 's' + + >>> pd.Timestamp("2020-01-01 12:34:56.123").unit + 'ms' + + >>> pd.Timestamp("2020-01-01 12:34:56.123456").unit + 'us' + + >>> pd.Timestamp("2020-01-01 12:34:56.123456789").unit + 'ns' """ return npy_unit_to_abbrev(self._creso)