@@ -998,8 +998,9 @@ class MinMaxReso:
998
998
and Timedelta class. On an instance, these depend on the object's _reso.
999
999
On the class, we default to the values we would get with nanosecond _reso.
1000
1000
"""
1001
- def __init__ (self , name ):
1001
+ def __init__ (self , name , docstring ):
1002
1002
self ._name = name
1003
+ self .__doc__ = docstring
1003
1004
1004
1005
def __get__ (self , obj , type = None ):
1005
1006
if self ._name == " min" :
@@ -1012,9 +1013,13 @@ class MinMaxReso:
1012
1013
1013
1014
if obj is None :
1014
1015
# i.e. this is on the class, default to nanos
1015
- return Timedelta(val)
1016
+ result = Timedelta(val)
1016
1017
else :
1017
- return Timedelta._from_value_and_reso(val, obj._creso)
1018
+ result = Timedelta._from_value_and_reso(val, obj._creso)
1019
+
1020
+ result.__doc__ = self .__doc__
1021
+
1022
+ return result
1018
1023
1019
1024
def __set__ (self , obj , value ):
1020
1025
raise AttributeError (f" {self._name} is not settable." )
@@ -1033,9 +1038,75 @@ cdef class _Timedelta(timedelta):
1033
1038
1034
1039
# higher than np.ndarray and np.matrix
1035
1040
__array_priority__ = 100
1036
- min = MinMaxReso(" min" )
1037
- max = MinMaxReso(" max" )
1038
- resolution = MinMaxReso(" resolution" )
1041
+
1042
+ _docstring_min = """
1043
+ Returns the minimum bound possible for Timedelta.
1044
+
1045
+ This property provides access to the smallest possible value that
1046
+ can be represented by a Timedelta object.
1047
+
1048
+ Returns
1049
+ -------
1050
+ Timedelta
1051
+
1052
+ See Also
1053
+ --------
1054
+ Timedelta.max: Returns the maximum bound possible for Timedelta.
1055
+ Timedelta.resolution: Returns the smallest possible difference between
1056
+ non-equal Timedelta objects.
1057
+
1058
+ Examples
1059
+ --------
1060
+ >>> pd.Timedelta.min
1061
+ -106752 days +00:12:43.145224193
1062
+ """
1063
+
1064
+ _docstring_max = """
1065
+ Returns the maximum bound possible for Timedelta.
1066
+
1067
+ This property provides access to the largest possible value that
1068
+ can be represented by a Timedelta object.
1069
+
1070
+ Returns
1071
+ -------
1072
+ Timedelta
1073
+
1074
+ See Also
1075
+ --------
1076
+ Timedelta.min: Returns the minimum bound possible for Timedelta.
1077
+ Timedelta.resolution: Returns the smallest possible difference between
1078
+ non-equal Timedelta objects.
1079
+
1080
+ Examples
1081
+ --------
1082
+ >>> pd.Timedelta.max
1083
+ 106751 days 23:47:16.854775807
1084
+ """
1085
+
1086
+ _docstring_reso = """
1087
+ Returns the smallest possible difference between non-equal Timedelta objects.
1088
+
1089
+ The resolution value is determined by the underlying representation of time
1090
+ units and is equivalent to Timedelta(nanoseconds=1).
1091
+
1092
+ Returns
1093
+ -------
1094
+ Timedelta
1095
+
1096
+ See Also
1097
+ --------
1098
+ Timedelta.max: Returns the maximum bound possible for Timedelta.
1099
+ Timedelta.min: Returns the minimum bound possible for Timedelta.
1100
+
1101
+ Examples
1102
+ --------
1103
+ >>> pd.Timedelta.resolution
1104
+ 0 days 00:00:00.000000001
1105
+ """
1106
+
1107
+ min = MinMaxReso(" min" , _docstring_min)
1108
+ max = MinMaxReso(" max" , _docstring_max)
1109
+ resolution = MinMaxReso(" resolution" , _docstring_reso)
1039
1110
1040
1111
@property
1041
1112
def value (self ):
0 commit comments