Skip to content

Conditional join #737

Closed
Closed
@samukweku

Description

Brief Description

I would like to propose conditional join, also known as non-equi joins, which is obtainable in SQL and R's datatable.

Example API

df1 = pd.DataFrame({'col_a': [1,2,3], 'col_b': ["A", "B", "C"]})
	col_a	col_b
0	1	A
1	2	B
2	3	C

df2 = pd.DataFrame({'col_a': [0, 2, 3], 'col_c': ["Z", "X", "Y"]})
     col_a	col_c
0	0	Z
1	2	X
2	3	Y

Please modify the example API below to illustrate your proposed API, and then delete this sentence.

# the join can be >, < or !=. I guess as we get a stable function, we can add others, and combine with equi-joins
df1.conditional_join(df2, left_column = "col_a", right_column = "col_a", join_operator = ">")
    col_a   col_b   col_c
0	1	A	Z
1	2	B	Z
2	3	C	Z
3	3	C	X

Metadata

Assignees

Labels

available for hackingThis issue has not been claimed by any individual.enhancementNew feature or requestgood first issueGood for newcomersgood intermediate issueIssues that are good for seasoned programmers to make a contributionhacktoberfestFor Hacktober issues :)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions