ComfyUI Node

Pandas Lt

Element-wise 'less than' between two DataFrames

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

Pandas Lt is the "is this less than that" node, applied cell by cell across two whole DataFrames. Every element in the first frame gets compared to the matching element in the second, and you get back a DataFrame of True/False. It's the raw material of filtering and flagging - build a boolean mask with it, then use Pandas Boolean Index to actually filter rows by that mask.

It comes from ComfyUI-Data-Analysis, the pack by Hide Inada (HowToSD) that wraps pandas into ComfyUI so you can run data analysis in the same node canvas you generate images in. Pandas Lt is one of a family of element-wise comparison nodes - Eq, Ne, Gt, Ge, Le, plus scalar variants - and it's a faithful passthrough of pandas' own DataFrame.lt().

How it works

The node does exactly a_dataframe.lt(b_dataframe). pandas aligns the two frames on their labels and compares positionally where they line up. Values where a < b become True; everything else - including NaN anywhere in the comparison - becomes False. It's not a one-liner summary ("is the whole table smaller?") but a cell-by-cell mask.

Where this gets useful: you can't usually do much with a boolean DataFrame by itself, but you can drop it into Pandas Boolean Index to filter rows, or treat it as a flag column you keep in your analysis. The point isn't the output, it's the downstream filtering it enables.

The inputs that matter

  • a_dataframe - the left side, the values being tested.
  • b_dataframe - the right side, the thresholds.

Both are required DATAFRAMEs. The output is a DATAFRAME of booleans with matching shape/labels. If you're comparing against a single number rather than a whole table, use Pandas Lt Scalar Float or Pandas Lt Scalar Int - same idea, one fewer node to build.

How to install it

Standard for this pack:

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 via ComfyUI Manager (search "Data analysis"). Restart and reload the browser tab. The pack brings pandas, matplotlib, seaborn, scipy, and scikit-learn; nothing GPU- or model-related here.

Common issues

  • All False, even for values that look smaller - mismatched labels between the two frames. pandas aligns on labels, so if the frames don't share index/column names, you get NaN comparisons → False everywhere. Keep the second frame derived from the first.
  • Shape surprises - the two frames need compatible shapes. A DataFrame against a DataFrame of different dimensions won't align the way you hope.
  • You only wanted to test one value - reach for the scalar variants instead; they're less wiring for the same result.

The honest take: you'll rarely need Pandas Lt frame-vs-frame. Most filtering is "column < some number," which is the scalar nodes' job. But when you've got two aligned tables, this is the clean way to compare them.

CategoryData Analysis

Inputs (2)

NameTypeDefaultDescription
a_dataframeDATAFRAME
b_dataframeDATAFRAME

Outputs (1)

NameTypeDescription
DATAFRAMEDATAFRAME