Skip to content

Commit cf618db

Browse files
committed
use new take
1 parent 155fc90 commit cf618db

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

pandas/core/indexes/base.py

+5-15
Original file line numberDiff line numberDiff line change
@@ -2170,21 +2170,11 @@ def _assert_take_fillable(self, values, indices, allow_fill=True,
21702170
fill_value=None, na_value=np.nan):
21712171
""" Internal method to handle NA filling of take """
21722172
indices = _ensure_platform_int(indices)
2173-
# only fill if we are passing a non-None fill_value
2174-
if allow_fill and fill_value is not None:
2175-
if (indices < -1).any():
2176-
msg = ('When allow_fill=True and fill_value is not None, '
2177-
'all indices must be >= -1')
2178-
raise ValueError(msg)
2179-
mask = indices == -1
2180-
if mask.all():
2181-
taken = np.full(indices.shape, fill_value=na_value)
2182-
else:
2183-
taken = values.take(indices)
2184-
if mask.any():
2185-
taken[mask] = na_value
2186-
else:
2187-
taken = values.take(indices)
2173+
# TODO: figure out what is going on with fill_value. It seems
2174+
# to be unused, other than that assertion that it's not None
2175+
# when allow_fill & any -1.
2176+
taken = algos.take(values, indices, allow_fill=allow_fill,
2177+
fill_value=na_value)
21882178
return taken
21892179

21902180
@cache_readonly

0 commit comments

Comments
 (0)