Pandas Boolean Index
Filter a table down to the rows that matter, with a True/False Series
- dataframe
- boolean_index_series
- DATAFRAME
Filtering is the most common thing you'll do with a dataset, and Pandas Boolean Index is how this pack does it. You feed it a DataFrame and a Series of True/False values, and it hands back just the rows where the Series says True. It's the graphical version of pandas' df[mask] - arguably the single most-used idiom in the whole library - and it's the node you'll reach for when you need "give me only the rows that meet this condition."
How it works
Under the hood it's dataframe[boolean_index_series]: the boolean Series acts as a row mask, and pandas keeps the rows where the mask is True. The Series must line up with the DataFrame's index - same length, same labels - or you'll get an error. The node even guards against feeding it something that isn't a Series, raising a clear "not a Series" ValueError instead of failing weirdly downstream.
Inputs and outputs
dataframe- the frame to filter (DATAFRAME)boolean_index_series- the mask, a PDSERIES of True/False, one entry per row- Output: a
DATAFRAMEcontaining only the rows where the mask is True
Where the mask comes from (the fiddly part)
This is where newcomers get stuck, so pay attention: the comparison nodes in this pack (Pandas Gt, Pandas Eq, etc.) return DataFrames, not boolean Series. That means the classic pandas one-liner df[df.col > 5] doesn't drop straight into this node - there's no node that produces a boolean Series from a column comparison. Your two practical routes:
- If a column is already genuinely boolean (True/False), pull it out with Pandas Select Column As Series and wire that in.
- Otherwise, build the mask by hand: type a JSON list of
true/falsevalues into CDA JSON Create, feed it to Pandas Create Series From List, and connect that.
It's a couple extra nodes for what feels like one operation, and honestly it's the pack's biggest ergonomic wart. Build the mask once, save the workflow, and you won't think about it again.
Installing it
Ships with ComfyUI-Data-Analysis (author Hide Inada / HowToSD.com). Manager: search Data Analysis → install → restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/HowToSD/ComfyUI-Data-Analysis.git
mv ComfyUI-Data-Analysis data-analysis
pip install -r data-analysis/requirements.txt
No GPU needed; pandas comes from requirements.txt (Manager installs it automatically).
Gotchas
Index alignment is the big one - a mask with a different index or length than the frame will error, and pandas is picky about it here. Watch for a mask that's one row short; it fails loudly rather than filtering wrong, which is the best you can ask for. And remember the output is a new DataFrame, so you can keep filtering downstream: Boolean Index → Boolean Index = chained AND, which covers a lot of real queries.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| dataframe | DATAFRAME | — | |
| boolean_index_series | PDSERIES | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| DATAFRAME | DATAFRAME | — |