Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiply two columns and save to another column #116

Closed
PoslavskySV opened this issue May 29, 2022 · 2 comments
Closed

Multiply two columns and save to another column #116

PoslavskySV opened this issue May 29, 2022 · 2 comments

Comments

@PoslavskySV
Copy link
Contributor

Hi guys,

thank you for great library. May be I just can't find this in docs (sorry if that is the case), but how I can e.g. multiply two columns or take a square root?
I have two columns with double values count1 and count2 and I want to do

df.map { count1 * count2 into "mul" }
// and
df.map { sqrt(count1 * count2) into "geomMean" }

The only thing I can do is to multiply on a fixed number

df.map { count1 * 2 into "smth" }

Thanks

@nikitinas
Copy link
Contributor

nikitinas commented May 29, 2022

Hi,

Currently only a limited set of column-wise operations are supported, but you can use from infix function to create columns from any row-wise expression:

df.map {
  "mul" from { count1 * count2 }
  "geomMean" from { sqrt(count1*count2) }
}

@PoslavskySV
Copy link
Contributor Author

Super, thank you! This is exactly what I was looking for.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants