We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9065c18 commit 4964d81Copy full SHA for 4964d81
pandas/core/indexes/range.py
@@ -1052,8 +1052,14 @@ def take(
1052
if is_scalar(indices):
1053
raise TypeError("Expected indices to be array-like")
1054
indices = ensure_platform_int(indices)
1055
- allow_fill = self._maybe_disallow_fill(allow_fill, fill_value, indices)
1056
- assert allow_fill is False, "allow_fill isn't supported by RangeIndex"
+
+ # If allow_fill=True and fill_value=None, just ignore allow_fill,
1057
+ # without raising an exception, as it's done in the base class.
1058
+ if allow_fill and fill_value is not None:
1059
+ cls_name = type(self).__name__
1060
+ raise ValueError(
1061
+ f"Unable to fill values because {cls_name} cannot contain NA"
1062
+ )
1063
1064
if len(indices) == 0:
1065
taken = np.array([], dtype=self.dtype)
0 commit comments