Nodes/ComfyUI-Data-Analysis/Py Kv Float Create
ComfyUI Node

Py Kv Float Create

Build a One-Key Dict From a Widget — Feed It Straight Into Pandas

By HowToSD·Created 2 years ago·Updated about a year ago· 23
Py Kv Float Create
    • PYDICT
    key
    value0

    Plenty of the Data Analysis pack's IO nodes want a Python dictionary as input - most notably Pandas Create From Dict, which turns a dict into a DataFrame. Py Kv Float Create is how you build one of those dicts by hand, with a string key and a float value, entirely from widgets.

    It's a small node, but it closes a real gap. Without it, your only way to hand a dict to those nodes was Py String To Dict and some careful typing. This gives you a typed, widget-driven alternative.

    How it works

    The node produces {key: value} - one key, one float, nothing clever. The key is a plain string you type, and the value comes from a FLOAT widget with a default of 0 and a range covering the full 64-bit float space (step down to 1e-8, so fine-grained values work). The output is a PYDICT, the pack's standard dictionary type.

    It pairs naturally with Pandas Create From Dict, which builds a DataFrame from a dict of column-name → column-data. So one Py Kv Float Create could hand you {"price": 3.99}, and that dict becomes a single-column frame ready to plot or transform.

    Inputs and outputs

    • key - the dictionary key, as a string.
    • value - the float to store under that key.

    Output: one PYDICT containing the single key-value pair.

    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 name
    pip install -r requirements.txt
    

    No models, no GPU - this is pure Python plumbing.

    Common issues

    The main thing to know: it makes one entry per node. There's no merge-into-existing-dict behavior here, so if you need a dict with several keys, you either chain several of these into a dict-consuming node that accepts multiple dicts (like Pandas Create From Multiple Dict) or hand-type a literal with Py String To Dict. Also, dictionary semantics apply: give it a duplicate key and the second value overwrites the first. And the FLOAT input is typed - if your value is really an integer, the sibling Py Kv Int Create keeps the type honest, though pandas rarely cares.

    CategoryData Analysis

    Inputs (2)

    NameTypeDefaultDescription
    keySTRING
    valueFLOAT0-9223372036854776000–9223372036854776000

    Outputs (1)

    NameTypeDescription
    PYDICTPYDICT