Convert apply('name') to a direct method invocation

Proprietary

When apply() on a pandas DataFrame or Series receives a string literal naming a reduction like 'sum' or 'mean', rewrite the call as a direct method invocation on the object. It only fires where the receiver's type resolves. It leaves alone any other name, which apply may resolve to a property or a numpy function, and a call holding comments.

org.openrewrite.python.cleanup.ReplaceApplyWithMethodCall
mod run . --recipe=org.openrewrite.python.cleanup.ReplaceApplyWithMethodCall

Install it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.