BUG/API: maybe drop recently introduced "takeable" from reindex? · Issue #6612 · pandas-dev/pandas (original) (raw)

I think there might be an issue with reindex(..., takeable=True) introduced in a recent release and you might want to consider deprecating/dropping it while it hasn't crept to user code too much.

The main reason is that reindex takeable is conceptually different from reindex: the latter can introduce new rows with values that must be filled while the former cannot. Essentially, reindex takeable is no more than a fancy indexing operation of numpy which is already available via iloc indexer. If you consider reindex parameters, you can see there' no additional value in reindex takeable:

So not only it adds no value, but it also increases complexity:

The last point has already caused a bug:

In [1]: s = pd.Series(list('abc'), index=np.arange(3)[::-1])

In [2]: s Out[2]: 2 a 1 b 0 c dtype: object

In [3]: s.take([2,1,0]) Out[3]: 0 c 1 b 2 a dtype: object

In [4]: s.reindex([2,1,0], takeable=True) Out[4]: 2 a 1 b 0 c dtype: object

In [5]: s.iloc[[2,1,0]] Out[5]: 2 a 1 b 0 c dtype: object

Of course, this can be fixed by inserting workarounds here and here but this will increase complexity even more and won't address the conceptual issue.