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

Joins columns with different names #122

Open
julienrbrt opened this issue Jun 11, 2020 · 1 comment
Open

Joins columns with different names #122

julienrbrt opened this issue Jun 11, 2020 · 1 comment

Comments

@julienrbrt
Copy link
Contributor

julienrbrt commented Jun 11, 2020

It does not seems to be possible to join dataframe if the key has different name between the two dataframes. The only option would be to make a copy of the dataframe and rename the columns.

It would be interesting if it was supported, with the same behavior as dyplr from the tidyverse:

left_join(table1, table2, by = c("first_name" = "name"))

which could look like in gota like

df1.InnerJoin(df2, "first_name = name")

which (I find) better than

df1.InnerJoin(df2.Copy().Rename("first_name", "name"), "first_name")

This could however give some problems with specific column names.

If anyone else has suggestion on how to make that look better, I'll gladly look for a way to implement it.

@julienrbrt julienrbrt changed the title Joins columns with different name Joins columns with different names Jun 11, 2020
@kniren
Copy link
Collaborator

kniren commented Jun 18, 2020

This is a good suggestion, I would like to see this in place, although I'm not a fan of using a string and would prefer a typesafe solution. With filters we use:

    dataframe.F{
        Colname:    "A",
        Comparator: series.Eq,
        Comparando: "a",
    },

And I think something similar could be done here, maybe:

    dataframe.MergeBy{
        Left:    "A",
        Right: "Different A",
    },

julienrbrt added a commit to julienrbrt/gota that referenced this issue Nov 19, 2020
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