DEPR: deprecate using some params as positional in (DataFrame|Series).apply
State: closed

Deprecate allowing using `raw`, `result_type` etc. as positional parameters in `DataFrame.apply` & `Series.apply`, i.e. requiring them to be keyword-only in the future.

EDIT: updated for intent.

Labels:
name: Deprecate
description: Functionality to remove in pandas
name: Apply
description: Apply, Aggregate, Transform, Map
name: Stale

Comments:
Why are you deprecating them? Do you intend to change anything that wouldn’t be possible otherwise?
> Why are you deprecating them? Do you intend to change anything that wouldn’t be possible otherwise?

Concretely I did it because `ser.apply(func, 0)` appears to be similar to `ser.agg(func, 0)`, but actually isn't (`ser.apply(func, 0)` is actually `ser.apply(func, convert_dtype=0)`, while `ser.agg(func, 0)` is `ser.agg(func, axis=0)`). Similarly, `ser.apply(func, 0)` seems to be similar to `df.apply(func, 0)` but isn't.

So this is a proposal to make the signatures more similar across these methods, by being able to add an `axis: Axis = 0` positional parameter to `Series.apply`  after this deprecation has been completed.

EDIT: So this is mostly motivated by the second positional param in `Series.apply`. I can revert the the `DataFrame.apply` part.
> Concretely I did it because `ser.apply(func, 0)` appears to be similar to `ser.agg(func, 0)`, but actually isn't (`ser.apply(func, 0)` is actually `ser.apply(func, convert_dtype=0)`, while `ser.agg(func, 0)` is `ser.agg(func, axis=0)`). Similarly, `ser.apply(func, 0)` seems to be similar to `df.apply(func, 0)` but isn't.

I don't think this is a good reason to deprecate other arguments. I think we should be deprecating the other arguments only if they are deemed "not worth the maintenance burden". It's not clear to me if that's the case here. Otherwise we should find other solutions.

Would making the signature `Series.apply(func, *, args, kwargs, convert_dtype, ...)` satisfy without losing functionality?
Personally I also object to the positional deprecation, this probably impact a lot of users while not offering any benefit on our side (maintenance wise) and I am also not convinced that this brings a big enough improvement for users to make it worthwhile. 
> Would making the signature Series.apply(func, *, args, kwargs, convert_dtype, ...) satisfy without losing functionality?

I must have written my intention out badly, i.e. I did not intend to propose deprecate the arguments, just them being positional. So my intention is to keep the arguments, but make them keyword-only in v3.0. 

Is there opposition to do that (I can check if there’s some bad phrasings in the PR if we agree on that goal)?

I’ve updated the title & OP to better reflect my intentions.
Yes, I object to this. The benefits don't outweigh the downside for me (as written above).


I'd feel differently if there was a maintenance benefit, but looks like this is purely cosmetic
> > Would making the signature Series.apply(func, *, args, kwargs, convert_dtype, ...) satisfy without losing functionality?
> 
> I must have written my intention out badly

Ah - no, the issue was my reading comprehension!

This pull request is stale because it has been open for thirty days with no activity. Please [update](https://pandas.pydata.org/pandas-docs/stable/development/contributing.html#updating-your-pull-request) and respond to this comment if you're still interested in working on this.
Seems like this proposal would need more discussion in an issue before proceeding so closing for now. Can reopen if we decided to move forward with this approach