We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 64a2d4d commit 829ec28Copy full SHA for 829ec28
pandas/core/indexes/range.py
@@ -1117,8 +1117,14 @@ def take(
1117
if is_scalar(indices):
1118
raise TypeError("Expected indices to be array-like")
1119
indices = ensure_platform_int(indices)
1120
- allow_fill = self._maybe_disallow_fill(allow_fill, fill_value, indices)
1121
- assert allow_fill is False, "allow_fill isn't supported by RangeIndex"
+
+ # If allow_fill=True and fill_value=None, just ignore allow_fill,
1122
+ # without raising an exception, as it's done in the base class.
1123
+ if allow_fill and fill_value is not None:
1124
+ cls_name = type(self).__name__
1125
+ raise ValueError(
1126
+ f"Unable to fill values because {cls_name} cannot contain NA"
1127
+ )
1128
1129
if len(indices) == 0:
1130
taken = np.array([], dtype=self.dtype)
0 commit comments