Pandas As Float
Force every cell to a number — junk becomes NaN, nothing explodes
- dataframe
- DATAFRAME
Loaded a CSV and half your columns came in as text? Mixed "10" and 10.0 and "N/A" in the same column? That's the exact moment you reach for Pandas As Float. It converts every cell in a DataFrame to a floating-point number, and anything it can't convert quietly becomes NaN instead of crashing your workflow. It's the "make this table safe to do math on" node.
How it works
The implementation runs pd.to_numeric(errors='coerce') across the frame and then casts to float. errors='coerce' is the interesting bit: instead of raising on garbage, it turns unparseable cells into NaN. So the string "10" becomes 10.0, the number 10 becomes 10.0, and the text "missing" becomes NaN. Nothing errors, you just get missing values where the data wasn't numeric.
That makes it a natural first stop before anything that demands numbers - correlation, covariance, math transforms, or plotting. Pandas Corr and Pandas Cov quietly ignore non-numeric columns anyway, but if you want to see what became NaN, this node plus Pandas Show DataFrame is the honest way.
Inputs and outputs
dataframe- the frame to convert (DATAFRAME)- Output: a
DATAFRAMEwith the same shape, all values float
One input, one output. There's no errors toggle - the coerce-to-NaN behavior is baked in, which is worth knowing because you can't ask it to throw on bad data.
Installing it
Part of ComfyUI-Data-Analysis by 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, no model downloads; pandas comes from requirements.txt (Manager installs it for you).
The trap to remember
NaN is contagious in a good way and a bad way. Good: a NaN in a cell doesn't break your graph, so a messy CSV won't halt a run. Bad: NaN is silent, so if you convert a column of IDs that happen to contain letters, you'll get a column of NaN and no error. Check your data after converting, especially before a plot or a correlation - Pandas Count right after Pandas As Float shows you exactly how many cells survived in each column. If a column you expected to be numeric comes back all-NaN, your source data isn't what you thought it was.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| dataframe | DATAFRAME | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| DATAFRAME | DATAFRAME | — |