ComfyUI Node

Pandas Ne

Find where two DataFrames disagree, cell by cell

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

Comparing two tables and finding where they differ is a classic data chore - new export vs old export, before vs after a transformation. Pandas Ne is the "not equal" node for that: it compares two DataFrames element by element and returns a DataFrame of True/False marking every cell that doesn't match. It's the natural complement to Pandas Eq in the pack's comparison family.

It's part of ComfyUI-Data-Analysis by Hide Inada (HowToSD), the extension that wraps pandas, Seaborn, and Matplotlib into ComfyUI nodes so data analysis runs in the same graph as image generation. Pandas Ne is a straight passthrough of pandas' DataFrame.ne().

How it works

The node calls a_dataframe.ne(b_dataframe). pandas aligns the two frames on labels and compares positionally. Cells where the values differ → True; equal cells → False; and any comparison involving NaNTrue, because in pandas a missing value never equals anything, including another NaN. That last bit is a subtle trap: two tables that are "identical" except both have NaN in the same spot will still light up as not-equal there.

The output is a DATAFRAME of booleans - a difference map. That's the whole product. You can use it directly as a flag table, or chain it into Pandas Boolean Index to pull out the rows where things changed.

The inputs that matter

  • a_dataframe - the reference frame.
  • b_dataframe - the frame being compared against it.

Both required. Output is a DATAFRAME of booleans with matching shape and labels.

How to install it

Standard pack install:

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

or ComfyUI Manager → search "Data analysis" → install → restart → reload. The pack's standard dependencies (pandas, matplotlib, seaborn, scipy, scikit-learn) come with it; no GPU, no model downloads.

Common issues

  • Everything reports different - mismatched labels. pandas compares by label alignment, so two tables with different column names or row indices will disagree everywhere. Compare tables that share structure.
  • NaN spots flag as different - expected: NaN != NaN in pandas. If missing-vs-missing shouldn't count as a change, clean your data first.
  • Comparing against one number - that's Pandas Ne Scalar Float's job; frame-vs-frame is for whole-table diffs.

The mental model: Pandas Eq is "where did they match?", Pandas Ne is "where did they drift?". If you're diffing exports, the second one is usually what you actually want.

CategoryData Analysis

Inputs (2)

NameTypeDefaultDescription
a_dataframeDATAFRAME
b_dataframeDATAFRAME

Outputs (1)

NameTypeDescription
DATAFRAMEDATAFRAME