def _assert_take_fillable(self, values, indices, allow_fill=True,
                              fill_value=None, na_value=np.nan):
        """ Internal method to handle NA filling of take """
        indices = com._ensure_platform_int(indices)

        # only fill if we are passing a non-None fill_value
        if allow_fill and fill_value is not None:
            if (indices < -1).any():
                msg = ('When allow_fill=True and fill_value is not None, '
                       'all indices must be >= -1')
                raise ValueError(msg)
            taken = values.take(indices)
            mask = indices == -1
            if mask.any():
                taken[mask] = na_value
        else:
            taken = values.take(indices)
        return taken
dataset/ETHPy150Open pydata/pandas/pandas/indexes/base.py/Index._assert_take_fillable/original