ENH: Add set_index to Series by h-vetinari · Pull Request #22225 · pandas-dev/pandas (original) (raw)

@jreback

This completely changes the semantics of DataFrame.set_index by allowing thru ambiguous cases of arrays.

I know you're very busy, but I get the feeling you don't read what I've repeated time and time again in this thread: this PR changes absolutely nothing about the behaviour of DataFrame.set_index - as evidenced by the lack of changes in tests/frame/test_alter_axes.py.

You have also not commented on #24046, which I opened specifically to discuss your opposition to the actual / current / existing capabilities of DataFrame.set_index.

Furthermore the semantics of Series are just plain weird, which only accept an array

The only difference between Series.set_index and DataFrame.set_index in this PR is that the former does not allow column keys - which simply do not make sense for Series.

We have set_axis for exactly this purpose, now you are conflating them.

I have responded to this in detail above and in #24046. I'm not conflating them.

So unless you remove this, and I don't now if this is possible for Series, then this is a no-go.

I don't know what you're referring to by "this", can you please elaborate?

There are two core devs who have approved this PR (not counting @WillAyd's change request since it was only about docstring validation), and you're objecting on grounds that do not reflect the actual state of affairs - so IMO you're quite off-base in claiming this PR is so outlandish.