Nodes/ComfyUI-Data-Analysis/Pandas Le Scalar Int
ComfyUI Node

Pandas Le Scalar Int

Flag every cell at or below an integer cutoff

By HowToSD·Created 2 years ago·Updated about a year ago· 23
Pandas Le Scalar Int
  • dataframe
  • DATAFRAME
number0

PandasLeScalarInt is the integer version of the pack's threshold-comparison nodes: compare every cell in a DataFrame against a single integer, and get back a boolean mask showing which cells are at or below it. Counts, stock levels, scores, ratings - anything that's a whole number and has a cutoff you care about.

It ships in HowToSD's ComfyUI-Data-Analysis pack, Hide Inada's wrapper set that drops pandas, matplotlib, and seaborn into ComfyUI's node graph. No GPU, no models - it's a one-line pandas comparison wearing a node costume.

How it works

The mechanism is dataframe.le(number), pandas' element-wise <= against a scalar integer. Every cell gets compared, and the output is a same-shaped DataFrame of booleans: True where the value is less than or equal to your number, False elsewhere. The number input is an INT widget with a 32-bit range, so anything from stock counts to inventory levels fits.

The result is a mask, not a filter. That's the design: the True/False DataFrame is meant to feed into the pack's boolean-index or row-selection nodes to pull out the rows that pass - "keep everything with stock ≤ 5," for instance. You can also use it just to count how many cells fall under the line.

The inputs that matter

  • dataframe - the table to test.
  • number - the integer threshold.

Output is a single DATAFRAME of booleans with the same index and columns as the input.

Installing it

The standard pack install. ComfyUI Manager: search "ComfyUI-Data-Analysis", install, restart - pandas, matplotlib, seaborn, scipy, scikit-learn, openpyxl, and lxml are handled for you. 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. License note, pack-wide: custom non-commercial license - personal and academic use is fine, commercial use needs the author's written permission.

Gotchas

Two things to keep straight. First, <= is inclusive: a cell exactly equal to your threshold returns True. If you mean "below," you want the strictly-less-than node instead - the names in this family are exact about inclusivity. Second, dtype mismatches: comparing an int column to an int is clean, but if your "int" column was loaded as floats or object dtype, pandas still compares fine - just be aware the mask output mirrors whatever the comparison semantics are for that dtype. And as with all the comparison nodes, the output is a mask - remember to chain a selection node if you wanted the actual rows, not the True/False map.

CategoryData Analysis

Inputs (2)

NameTypeDefaultDescription
dataframeDATAFRAME
numberINT0-2147483648–2147483648

Outputs (1)

NameTypeDescription
DATAFRAMEDATAFRAME