polars icon indicating copy to clipboard operation
polars copied to clipboard

feat(python, rust): add mean_horizontal expression

Open romanovacca opened this issue 1 year ago • 5 comments

as discussed in #9966, implemented mean_horizontal.

If this is the way to go, I will create separate PR's for others.

romanovacca avatar Oct 22 '23 16:10 romanovacca

Thank you @romanovacca. Can you rebase? Then it is good to go.

ritchie46 avatar Nov 02 '23 13:11 ritchie46

Thank you @romanovacca. Can you rebase? Then it is good to go.

Done!

romanovacca avatar Nov 02 '23 14:11 romanovacca

Whoops, we need another rebase. :')

ritchie46 avatar Nov 18 '23 11:11 ritchie46

@ritchie46 sorry for the delay. I don't think this is relevant anymore after #12492, right?

One thing I do still see is that that PR still uses the ".map(|opt_s| opt_s.map(|s| s.with_name("max")))" format, which automatically creates a column with the name, whereas iirc you mentioned you want it to take on the lefthand column name and thus leave that part out. I can do that in a new PR if you want to?

romanovacca avatar Dec 02 '23 21:12 romanovacca

We still don't have a mean_horizontal, so this PR is still welcome. It would be nicer though if the drive-by changes could be split into a separate PR. Mixing refactors and new features is usually a bad idea.

stinodego avatar Jan 13 '24 11:01 stinodego

Hey @romanovacca

I was trying to add this but just noticed you have already implemented it.

  • https://github.com/pola-rs/polars/compare/main...cmdlineluser:polars:feat-expr-mean_horizontal

From what I can tell, all that needs to change here is that df.hmean has since been renamed to df.mean_horizontal

(And the edits to any, all, sum need to be taken out.)

cmdlineluser avatar Jan 28 '24 11:01 cmdlineluser

Superseded by #14369

stinodego avatar Feb 08 '24 15:02 stinodego