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

Pandas Le Scalar Float

Flag every cell that's at or below a float threshold

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

"Which of my values are at or below 4.5?" That's the whole job of PandasLeScalarFloat. You give it a DataFrame and a float, and it returns a same-shaped DataFrame of booleans - True where each cell is less than or equal to your number, False where it isn't. It's the threshold-comparison node, the one you reach for when you want to flag cheap items, low scores, or anything under a cutoff.

It comes from HowToSD's ComfyUI-Data-Analysis pack - Hide Inada's collection of pandas, matplotlib, and seaborn wrappers for ComfyUI. No GPU, no models, just a pandas comparison.

How it works

The call is dataframe.le(number) - pandas' element-wise <= against a scalar. Every cell is compared to your single float, and the output is a DataFrame of booleans with the same index and columns as the input. "Le" is the pandas method-name shorthand for "less than or equal," and the scalar variant is the simplest member of the pack's comparison family.

The output is a mask - True/False per cell. That's not usually the end of the line; it's typically a stepping stone. You'd feed the mask into the pack's boolean-index or row-selection nodes to keep only the rows that pass, or use it to compute counts of values under the threshold.

The number input is a FLOAT widget with a large range, so decimal thresholds like 4.5 or 0.00001 are no problem.

The inputs that matter

  • dataframe - the table to test.
  • number - the float threshold, typed in the widget.

Output is a single DATAFRAME of booleans, same shape as the input.

Installing it

Standard pack install. ComfyUI Manager: search "ComfyUI-Data-Analysis", install, restart. It handles pandas, matplotlib, seaborn, scipy, scikit-learn, openpyxl, and lxml for you. Manual route:

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

Then rename the clone to data-analysis if you want the example workflows to resolve. And the pack license, since it applies everywhere: custom non-commercial - personal and academic use is allowed, commercial use needs the author's written permission.

Gotchas

The output is booleans, not the matching values. Beginners expect the filtered data and get a mask instead - that's not a bug, that's the design; chain a selection node on the end. Comparison against a float is exact <=, so a cell exactly equal to your threshold returns True; if you want strictly less-than, you need the strictly-less-than sibling node. And if your table holds NaN values, NaN comparisons return False (or NaN behavior depending on dtype) - decide whether you want to drop or fill them before you threshold, or they'll quietly never match.

CategoryData Analysis

Inputs (2)

NameTypeDefaultDescription
dataframeDATAFRAME
numberFLOAT0-9223372036854776000–9223372036854776000

Outputs (1)

NameTypeDescription
DATAFRAMEDATAFRAME