@@ -2041,13 +2041,21 @@ def is_monotonic_increasing(self) -> bool:
2041
2041
"""
2042
2042
Return a boolean if the values are equal or increasing.
2043
2043
2044
+ Returns
2045
+ -------
2046
+ bool
2047
+
2048
+ See Also
2049
+ --------
2050
+ Index.is_monotonic_decreasing : Check if the values are equal or decreasing.
2051
+
2044
2052
Examples
2045
2053
--------
2046
- >>> Index([1, 2, 3]).is_monotonic_increasing
2054
+ >>> pd. Index([1, 2, 3]).is_monotonic_increasing
2047
2055
True
2048
- >>> Index([1, 2, 2]).is_monotonic_increasing
2056
+ >>> pd. Index([1, 2, 2]).is_monotonic_increasing
2049
2057
True
2050
- >>> Index([1, 3, 2]).is_monotonic_increasing
2058
+ >>> pd. Index([1, 3, 2]).is_monotonic_increasing
2051
2059
False
2052
2060
"""
2053
2061
return self ._engine .is_monotonic_increasing
@@ -2057,13 +2065,21 @@ def is_monotonic_decreasing(self) -> bool:
2057
2065
"""
2058
2066
Return a boolean if the values are equal or decreasing.
2059
2067
2068
+ Returns
2069
+ -------
2070
+ bool
2071
+
2072
+ See Also
2073
+ --------
2074
+ Index.is_monotonic_increasing : Check if the values are equal or increasing.
2075
+
2060
2076
Examples
2061
2077
--------
2062
- >>> Index([3, 2, 1]).is_monotonic_decreasing
2078
+ >>> pd. Index([3, 2, 1]).is_monotonic_decreasing
2063
2079
True
2064
- >>> Index([3, 2, 2]).is_monotonic_decreasing
2080
+ >>> pd. Index([3, 2, 2]).is_monotonic_decreasing
2065
2081
True
2066
- >>> Index([3, 1, 2]).is_monotonic_decreasing
2082
+ >>> pd. Index([3, 1, 2]).is_monotonic_decreasing
2067
2083
False
2068
2084
"""
2069
2085
return self ._engine .is_monotonic_decreasing
@@ -2108,6 +2124,34 @@ def _is_strictly_monotonic_decreasing(self) -> bool:
2108
2124
def is_unique (self ) -> bool :
2109
2125
"""
2110
2126
Return if the index has unique values.
2127
+
2128
+ Returns
2129
+ -------
2130
+ bool
2131
+
2132
+ See Also
2133
+ --------
2134
+ Index.has_duplicates : Inverse method that checks if it has duplicate values.
2135
+
2136
+ Examples
2137
+ --------
2138
+ >>> idx = pd.Index([1, 5, 7, 7])
2139
+ >>> idx.is_unique
2140
+ False
2141
+
2142
+ >>> idx = pd.Index([1, 5, 7])
2143
+ >>> idx.is_unique
2144
+ True
2145
+
2146
+ >>> idx = pd.Index(["Watermelon", "Orange", "Apple",
2147
+ ... "Watermelon"]).astype("category")
2148
+ >>> idx.is_unique
2149
+ False
2150
+
2151
+ >>> idx = pd.Index(["Orange", "Apple",
2152
+ ... "Watermelon"]).astype("category")
2153
+ >>> idx.is_unique
2154
+ True
2111
2155
"""
2112
2156
return self ._engine .is_unique
2113
2157
@@ -2122,6 +2166,10 @@ def has_duplicates(self) -> bool:
2122
2166
bool
2123
2167
Whether or not the Index has duplicate values.
2124
2168
2169
+ See Also
2170
+ --------
2171
+ Index.is_unique : Inverse method that checks if it has unique values.
2172
+
2125
2173
Examples
2126
2174
--------
2127
2175
>>> idx = pd.Index([1, 5, 7, 7])
@@ -2547,6 +2595,10 @@ def hasnans(self) -> bool:
2547
2595
Return True if there are any NaNs.
2548
2596
2549
2597
Enables various performance speedups.
2598
+
2599
+ Returns
2600
+ -------
2601
+ bool
2550
2602
"""
2551
2603
if self ._can_hold_na :
2552
2604
return bool (self ._isnan .any ())
0 commit comments