ComfyUI Node

Pandas Le

Element-by-element 'less than or equal to' between two tables

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

PandasLe is the "compare every cell against another table's matching cell" node. Feed it two DataFrames of the same shape, and it returns a third DataFrame where every cell is a boolean: True where the left value is less than or equal to the right value, False otherwise. It's a logical operation from the pandas comparison family, and it's what you use when you need a mask - a per-cell True/False map - to drive filtering or flagging downstream.

It's part of HowToSD's ComfyUI-Data-Analysis pack, Hide Inada's wrapper set that brings pandas, matplotlib, and seaborn into ComfyUI. No GPU, no models - plain pandas.

How it works

Under the hood it calls a_dataframe.le(b_dataframe) - pandas' element-wise <= operator. The result is a DataFrame of booleans, same shape as the inputs, with the same index and columns. "Le" is the pandas method-name abbreviation for "less than or equal," and you'll see the same naming pattern across the pack's logical nodes (PandasGt, PandasGe, PandasEq, and so on).

Because the comparison is positional-by-alignment - pandas aligns on index and column labels, not on row order - the two DataFrames need matching shapes and labels for the output to make sense. Mismatched labels produce NaN in the mask rather than a crash, which is subtle: a NaN boolean mask behaves like False in most filters but not identically.

The classic use: compare a table against a threshold table or a reference table, get your True/False mask, and use it to select rows or flag outliers.

The inputs that matter

  • a_dataframe - the left side of the comparison.
  • b_dataframe - the right side.

Output is a single DATAFRAME of booleans. That mask can feed into row-selection or boolean-index nodes in the pack.

Installing it

Standard for this pack. ComfyUI Manager: search "ComfyUI-Data-Analysis", install, restart. Dependencies - pandas, matplotlib, seaborn, scipy, scikit-learn, openpyxl, lxml - are installed automatically. Manual:

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 for the example workflows to work. License: custom non-commercial - personal and academic use is fine, commercial use needs the author's written permission.

Gotchas

Shape and label alignment is the whole game. If the two DataFrames don't have matching indexes or columns, pandas aligns what it can and fills the gaps with NaN - so your "boolean" mask suddenly contains NaN, which filters behave oddly with. If you're comparing row-by-row in physical order and the tables' indexes differ, you'll get a misaligned mess; normalize indexes first. And if your actual goal is comparing against a single number rather than another table, the scalar variants (Pandas Le Scalar Int / Float) are simpler and less error-prone - this node only earns its keep when the comparison target is itself a table.

CategoryData Analysis

Inputs (2)

NameTypeDefaultDescription
a_dataframeDATAFRAME
b_dataframeDATAFRAME

Outputs (1)

NameTypeDescription
DATAFRAMEDATAFRAME