Py String To Float
Parse a Number Out of a Text Field — With All the Float Quirks
- FLOAT
Text boxes are where numbers go to stop being numbers. Py String To Float is the rescue: it takes a string like "3.14" and produces a real FLOAT that math nodes and data nodes will accept.
It's the mirror of Py Float To String, and it's a node you'll grab the moment a value arrives from a CSV column or a text widget and the next node refuses to touch a string.
How it works
It's Python's float(value) - a single cast. That means it's lenient about whitespace (leading/trailing spaces are fine) and it understands scientific notation: "1.5e3" parses to 1500.0. It doesn't understand human formatting: "1,000" will raise, and "$4.99" will raise. Clean decimal text in, float out.
Because it's a plain cast, you inherit all the float realities - "0.1" becomes the float nearest 0.1, and any arithmetic downstream is binary-float arithmetic. That's not a node bug; that's how floats work.
Inputs and outputs
value- the string to parse, single-line.
Output: a FLOAT. Wire it into any numeric socket.
Install
Ships in HowToSD/ComfyUI-Data-Analysis. Manager: search "Data analysis" in the Custom Node Manager, install ComfyUI-Data-Analysis, restart, reload the browser. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/HowToSD/ComfyUI-Data-Analysis.git
mv ComfyUI-Data-Analysis data-analysis # README: example workflows expect this folder name
pip install -r requirements.txt
No models, no GPU - it's a cast with a UI.
Common issues
Errors are loud and immediate: any string that isn't a valid Python float raises ValueError, so you'll see the failure right in the console. The usual culprits are thousands separators ("1,000"), currency symbols, and locale decimals - if your data uses commas as decimal points, this won't parse it. Also note the input is a single-line string; if you paste multi-line text in, float() chokes on the newline. And when you round-trip through Py Float To String, remember the string side does no rounding, so 0.1 + 0.2 round-trips as "0.30000000000000004".
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| value | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| FLOAT | FLOAT | — |