ComfyUI Node

Pandas Join

Merge two DataFrames on a shared column, visually

By HowToSD·Created 2 years ago·Updated about a year ago· 23
Pandas Join
  • left_dataframe
  • right_dataframe
  • DATAFRAME
on_column_name
join_method

Real data rarely lives in one table. You've got players in one CSV and their stats in another, keyed by an ID - and what you actually want is both side by side. PandasJoin is the node that combines two DataFrames on a common column, with the four classic SQL join types available as a dropdown. It's the pack's "make one table out of two" node, and it's one of the most useful tools in the whole set once you're doing anything beyond single-file analysis.

It comes from HowToSD's ComfyUI-Data-Analysis pack - Hide Inada's collection of pandas, matplotlib, and seaborn wrappers for ComfyUI. No GPU, no models, just pandas doing pandas things.

How it works

Under the hood it calls pd.merge(left, right, on=on_column_name, how=join_method). Both DataFrames go in, you tell it which column is the key, and pandas lines up rows where the key values match. The join_method dropdown is the four SQL joins, and the differences matter:

  • inner - only rows where the key exists in both tables. The default you'll want most of the time.
  • left - all rows from the left table, matching right-table values where they exist, NaN where they don't.
  • right - the mirror image.
  • outer - everything from both, NaN filling the gaps.

If the key column has a different name in each table, you'd normally give pandas left_on and right_on - but this node only exposes a single on_column_name, so both tables need to agree on the name. Keep that in mind when you're preparing your inputs.

The inputs that matter

  • left_dataframe and right_dataframe - the two tables. Order matters for left/right joins, so wire them deliberately.
  • on_column_name - the shared key column, as a string. This is the one to get exactly right; a typo fails the run.
  • join_method - inner / left / right / outer.

Output is a single merged DATAFRAME.

Installing it

Standard pack install. ComfyUI Manager: search "ComfyUI-Data-Analysis", install, restart. It handles pandas, matplotlib, seaborn, scipy, scikit-learn, openpyxl, and lxml automatically. Manual route:

cd ComfyUI/custom_nodes
git clone https://github.com/HowToSD/ComfyUI-Data-Analysis.git
pip install -r requirements.txt

Rename the folder to data-analysis if you want the example workflows to resolve. And the license: custom non-commercial - personal/academic use is fine, commercial use needs the author's written permission.

Gotchas

The single key-column constraint is the real limit here. If your key is named differently in the two tables, or you need to join on multiple columns, this node can't express it - clean up your columns first or reach for a different approach. Watch for duplicated keys, too: if a key appears multiple times in one table, the join multiplies rows, and the result can look like a data explosion. And it's worth knowing what the "Join" in the name is not - this is a column-key merge (SQL-style), not pandas' DataFrame.join() on the index. If you want to merge on index labels, that's a different node.

CategoryData Analysis

Inputs (4)

NameTypeDefaultDescription
left_dataframeDATAFRAME
right_dataframeDATAFRAME
on_column_nameSTRING
join_methodCOMBO4 options: inner, left, right, outer

Outputs (1)

NameTypeDescription
DATAFRAMEDATAFRAME