Nodes/ComfyUI-Data-Analysis/Py Float To String
ComfyUI Node

Py Float To String

Turn a Number Into Text — Because Some Nodes Only Speak Strings

By HowToSD·Created 2 years ago·Updated about a year ago· 23
Py Float To String
    • STRING
    value0

    This node does exactly one thing: str(value) on a float. That's not a dismissal - it's the point. In a data-analysis workflow you'll constantly hit the situation where a number lands in a FLOAT socket but the thing you want to feed - a text label, a filename, a comment - only accepts STRING. Py Float To String is that adapter.

    It's a tiny utility, the kind of thing you'd normally type on the Python side in two seconds. If you're building graphs entirely out of nodes, you need it.

    How it works

    Straight float to str conversion, nothing more. No rounding, no thousands separators, no locale handling - what Python's str() produces is what you get. That means 0.5 becomes "0.5", but if your value came from arithmetic, you can get the full binary representation: 0.1 + 0.2 yields "0.30000000000000004", which will make you doubt reality for a moment. It's not a bug in the node; that's just floats. If you need rounded output, round the number before it gets here.

    Inputs and outputs

    • value - a FLOAT, default 0. The widget range is wide enough (basically the full 64-bit float range, step down to 1e-8) that any number you'd reasonably type fits.

    Output: a STRING holding the decimal text, ready for text-display nodes, filename builders, or prompt-style text fields.

    Install

    Ships in the HowToSD/ComfyUI-Data-Analysis pack. 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 model downloads, no GPU, no heavy lifting beyond the pack's pandas/matplotlib install.

    Common issues

    Not much to trip on with a one-liner. The main gotchas: don't expect formatting (no padding, no rounding), and remember this is a typed FLOAT input - if your number is already a string, you don't need this node. And if you're feeding the output into something that later parses it back to a number, keep the full precision or the round trip won't match.

    CategoryData Analysis

    Inputs (1)

    NameTypeDefaultDescription
    valueFLOAT0-9223372036854776000–9223372036854776000

    Outputs (1)

    NameTypeDescription
    STRINGSTRING