File tree 2 files changed +23
-3
lines changed
2 files changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -73,8 +73,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
73
73
-i " pandas.Period.freq GL08" \
74
74
-i " pandas.Period.ordinal GL08" \
75
75
-i " pandas.RangeIndex.from_range PR01,SA01" \
76
- -i " pandas.Series.dt.unit GL08" \
77
- -i " pandas.Series.pad PR01,SA01" \
78
76
-i " pandas.Timedelta.max PR02" \
79
77
-i " pandas.Timedelta.min PR02" \
80
78
-i " pandas.Timedelta.resolution PR02" \
Original file line number Diff line number Diff line change @@ -2073,7 +2073,29 @@ def _creso(self) -> int:
2073
2073
2074
2074
@cache_readonly
2075
2075
def unit (self ) -> str :
2076
- # e.g. "ns", "us", "ms"
2076
+ """
2077
+ The precision unit of the datetime data.
2078
+
2079
+ Returns the precision unit for the dtype.
2080
+ It means the smallest time frame that can be stored within this dtype.
2081
+
2082
+ Returns
2083
+ -------
2084
+ str
2085
+ Unit string representation (e.g. "ns").
2086
+
2087
+ See Also
2088
+ --------
2089
+ TimelikeOps.as_unit : Converts to a specific unit.
2090
+
2091
+ Examples
2092
+ --------
2093
+ >>> idx = pd.DatetimeIndex(["2020-01-02 01:02:03.004005006"])
2094
+ >>> idx.unit
2095
+ 'ns'
2096
+ >>> idx.as_unit("s").unit
2097
+ 's'
2098
+ """
2077
2099
# error: Argument 1 to "dtype_to_unit" has incompatible type
2078
2100
# "ExtensionDtype"; expected "Union[DatetimeTZDtype, dtype[Any]]"
2079
2101
return dtype_to_unit (self .dtype ) # type: ignore[arg-type]
You can’t perform that action at this time.
0 commit comments