Nodes/ComfyUI-Data-Analysis/Pandas Horizontal Concat
ComfyUI Node

Pandas Horizontal Concat

Glue two tables side by side

By HowToSD·Created 2 years ago·Updated about a year ago· 23
Pandas Horizontal Concat
  • a_dataframe
  • b_dataframe
  • DATAFRAME
reset_labelsfalse

Pandas Horizontal Concat sticks two DataFrames together side by side, like putting two tables next to each other on a desk. The columns of frame A stay put, the columns of frame B get added to the right of them, and the result is one wider frame. "Horizontal" here means "along the column axis" - which is the opposite of Pandas Vertical Concat, the pack's row-stacking node, so it's worth pausing on the naming before you wire things up.

Why reach for it? Because real datasets are assembled from pieces. One CSV has the numeric measurements, another has the labels, and you want them in a single frame so downstream nodes (and especially plotting nodes) see one coherent table. It's also how you'd add a computed column set to your existing data - build the new columns as a second frame, concat, done.

How it works

The implementation is pd.concat([a, b], axis=1) - pandas' column-wise concatenation. The important subtlety is how pandas lines up the rows: it aligns on the index, not on position. If both frames have the same row labels in the same order, you get a clean side-by-side join. If the indexes differ or are out of order, pandas still pairs rows by label, and anywhere a label exists on only one side you get NaN in the other frame's columns. That's usually correct behavior, but if your two CSVs were loaded independently and have mismatched or duplicate indexes, "side by side" quietly becomes "aligned by label with holes." When you just want positional pairing, make sure both frames have matching indexes first.

Then there's reset_labels (default off). Turn it on and the combined frame's column labels are replaced with a plain sequential integer index (0, 1, 2…), which is handy when you don't care about column names and just want clean positional access afterward. Note it only resets columns - the row index is left alone.

Inputs and outputs

  • a_dataframe (required, DATAFRAME) - the left frame.
  • b_dataframe (required, DATAFRAME) - the right frame.
  • reset_labels (required, BOOLEAN, default off) - replace column labels with integers.
  • DATAFRAME output - the combined frame.

Installing it

Standard pack install. ComfyUI Manager → search "Data analysis" → install ComfyUI-Data-Analysis → restart → reload. Manual:

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

Requirements: pandas, matplotlib, seaborn, scipy, scikit-learn, openpyxl, lxml. No GPU, no model downloads. If your concat comes out full of NaN, it's the index-alignment behavior above - that's the standard gotcha, and it's a data problem, not an install problem.

CategoryData Analysis

Inputs (3)

NameTypeDefaultDescription
a_dataframeDATAFRAME
b_dataframeDATAFRAME
reset_labelsBOOLEANfalse

Outputs (1)

NameTypeDescription
DATAFRAMEDATAFRAME