-
-
Notifications
You must be signed in to change notification settings - Fork 317
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
replace function - replace different column than input column #72
Comments
There are a few ways of doing that: First, every method that expects a functor, also excepts a lambda. Alternatively, you can use the Please see examples in |
Thanks for the pointer. Works great.
|
one note:
|
Thanks for the advice. Still fairly new to C++, so I appreciate this. |
Hi,
I want to replace values in one column according to values in another.
So for example I have the dataframe:
index: {0, 1, 2, 3, 4, 5, 6, 7}
int_col: { 1, 2, 3, 50, 6, 7, 8, 30}
int_col_2: { 5,5,5,5,5,5,5,5}
And I want to replace
int_col_2
values with 0 or 1, if the corresponding value atint_col
is odd or evenSo my desired output would be:
index: {0, 1, 2, 3, 4, 5, 6, 7}
int_col: { 1, 2, 3, 50, 6, 7, 8, 30}
int_col_2: { 0, 1, 0, 1, 1, 0, 1, 1}
Is this possible to achieve using the replace function using functors? I ask because it seems as though you can only pass one column for input which is the same one affected by the functor e.g.
However to perform my task my ReplaceFunctor will have to look something like this:
Please let me know if there's a way to achieve this using the replace function (or any other function for that matter), or if there's an example of something like this that I missed in the docs.
Thanks
The text was updated successfully, but these errors were encountered: