Skip to content

[ENH] Add anti joins to conditional_join - #1633

Open
samukweku wants to merge 4 commits into
devfrom
issue-1627-anti-join
Open

[ENH] Add anti joins to conditional_join#1633
samukweku wants to merge 4 commits into
devfrom
issue-1627-anti-join

Conversation

@samukweku

Copy link
Copy Markdown
Collaborator

Summary

  • add how="left_anti" and how="right_anti" to conditional_join
  • preserve pandas-style output columns and optional merge indicators
  • make anti-join membership independent of keep="first" or keep="last"
  • require selected columns from the side preserved by an anti join
  • consolidate unmatched-position discovery behind a faster NumPy boolean mask
  • document the public behavior, including an ELI5 explanation
  • record the correct environment-qualified full-suite command

ELI5

A conditional join asks whether rows from two tables satisfy the supplied rules. A left anti join keeps the left rows that never find a matching right row. A right anti join does the same from the other direction. For example, it can find events that do not fall inside any time window.

Performance

On a local 200,000-row _create_frame microbenchmark, the shared boolean-mask implementation improved unmatched-position handling by approximately 2.2x to 3.5x across left, right, outer, and anti joins. Broader result-materialization work is tracked separately in #1632.

Validation

  • pixi run -e tests test: 1334 passed, 5 skipped, 48 xfailed, 17 xpassed
  • conditional-join doctests: 2 passed
  • focused pre-commit checks: passed
  • standalone baseline-aware Markdown lint: passed
  • git diff --check: passed

Repository-wide pre-commit currently reports existing Ruff failures in example notebooks and janitor/functions/convert_date.py; none are in files changed by this PR.

The pixi.lock local-package version refresh was generated by the repository pixi-install hook after the upstream 0.32.24 version bump.

Fixes #1627

Related: #1632

@github-actions

github-actions Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://pyjanitor-devs.github.io/pyjanitor/pr-preview/pr-1633/

Built to branch gh-pages at 2026-08-20 03:12 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@samukweku
samukweku force-pushed the issue-1627-anti-join branch from 50fc7da to 1416b3e Compare August 20, 2026 03:11
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

Successfully merging this pull request may close these issues.

Add anti-join for conditional_join

1 participant