We only use pandas-style take when allow_fill is True _and_ fill_value is not None.
(self, allow_fill: bool, fill_value, indices)
| 1304 | |
| 1305 | @final |
| 1306 | def _maybe_disallow_fill(self, allow_fill: bool, fill_value, indices) -> bool: |
| 1307 | """ |
| 1308 | We only use pandas-style take when allow_fill is True _and_ |
| 1309 | fill_value is not None. |
| 1310 | """ |
| 1311 | if allow_fill and fill_value is not None: |
| 1312 | # only fill if we are passing a non-None fill_value |
| 1313 | if self._can_hold_na: |
| 1314 | if (indices < -1).any(): |
| 1315 | raise ValueError( |
| 1316 | "When allow_fill=True and fill_value is not None, " |
| 1317 | "all indices must be >= -1" |
| 1318 | ) |
| 1319 | else: |
| 1320 | cls_name = type(self).__name__ |
| 1321 | raise ValueError( |
| 1322 | f"Unable to fill values because {cls_name} cannot contain NA" |
| 1323 | ) |
| 1324 | else: |
| 1325 | allow_fill = False |
| 1326 | return allow_fill |
| 1327 | |
| 1328 | def repeat(self, repeats, axis: None = None) -> Self: |
| 1329 | """ |