ComfyUI Node

Pandas Drop NA

Delete the rows with missing values before they corrupt your math

By HowToSD·Created 2 years ago·Updated about a year ago· 23
Pandas Drop NA
  • dataframe
  • DATAFRAME

Pandas Drop NA is the other half of the pack's data-cleansing duo, and it's the one you'll reach for constantly. Real datasets have holes - empty cells, NaN, missing entries from a join or a partial import - and the moment a NaN reaches a mean, sum, or plot, it either silently poisons the result or propagates through every node downstream. This node deletes rows that contain missing values, so the rest of your pipeline only ever sees complete records.

Mechanism, one call:

return (dataframe.dropna(),)

Input: dataframe (DATAFRAME). Output: a DATAFRAME with incomplete rows removed. No other options are exposed, so you're getting pandas' defaults - and the default matters more than people realize.

What the default actually drops

dropna() with no arguments removes any row that contains at least one missing value, in any column. That's a blunt instrument:

  • One NaN in one column of a 20-column row and the whole row is gone. If your table is wide, you can lose a lot of rows this way.
  • It operates on rows, not cells. The surviving rows are fully populated, which is exactly what you want when the downstream step is division (NaN divides badly) or aggregation (NaN sums quietly wrong).
  • The output keeps the original index labels of surviving rows, so expect gaps. That's normal - it's the same "index now has holes" behavior as Drop Duplicates.

The key contrast with the pack's alternative: Pandas Fill NA Scalar Float / Int fills missing values with a constant instead of deleting rows. That's the choice to make consciously. If a missing value means "this record is unusable," drop it - this node. If it means "we just don't know this cell," filling with 0 or a mean may preserve data you'd otherwise lose. The drop is safer; the fill is more data-preserving. Both beat doing nothing.

The trap

Because it deletes whole rows silently, you can run this node and watch your row count shrink without any feedback. Wire a Pandas Show DataFrame before and after to see how many records you're actually losing - if a wide table loses 80% of its rows, that's a signal your data has a structural problem, not a reason to celebrate the clean output.

Install

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 ComfyUI Manager → search "Data analysis" → install → restart. No GPU, no model files - pandas is the entire dependency, and requirements.txt handles it.

CategoryData Analysis

Inputs (1)

NameTypeDefaultDescription
dataframeDATAFRAME

Outputs (1)

NameTypeDescription
DATAFRAMEDATAFRAME