Pandas Loc Cell String
Pull one cell out of a DataFrame as text
- dataframe
- STRING
Sometimes you don't want the whole table. You want one value - the exact batting average, the price, the name - and you want it as a string you can drop into a prompt, a filename, or a text node. That's the entire job of Pandas Loc Cell String: pick a cell by its row label and column label, and get it back as plain text.
It belongs to the ComfyUI-Data-Analysis pack from Hide Inada (HowToSD), which wraps pandas into ComfyUI so you can run data pipelines next to your image generation. The loc nodes are the "reach into the data and grab something" family, and this is the cell-level member. If you've got a lookup table in a DataFrame and you want the value to drive something downstream, this is the node you'll reach for.
How it works
Under the hood it's pandas label-based indexing: dataframe.loc[row_index, column_label], then str(value) on the result. That "as string" bit is the point - regardless of whether the cell holds an int, float, date, or string, you get a string out, so it slots into ComfyUI's text system without type gymnastics.
The two type dropdowns (row_index_type, column_label_type, each string or int) tell the node whether to cast your text inputs to integers before doing the lookup. This matters more than it looks: .loc matches labels literally. If your DataFrame has a plain 0, 1, 2… RangeIndex, that's an int index, so pick int; a date or name index means string. Pick wrong and you get a KeyError for a value that's visibly sitting right there in the table.
The inputs that matter
dataframe- theDATAFRAMEto reach into.row_indexandcolumn_label- the label and column to grab, as strings.row_index_type/column_label_type- the two enums above. Both default tostring; switch tointwhen your index or columns are integer labels.
Output is a single STRING - wire it into a text encoder, a filename builder, or a display node.
How to install it
It's part of the one-stop pack, so:
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. Then restart and reload the page. It pulls pandas, matplotlib, seaborn, and friends - heavy for a "read one cell" node, but they're shared with the whole pack. No GPU, no models.
Common issues
KeyErroron a value you can see - almost always the index/column type enum. Confirm whether your labels are integers or strings and set the matching dropdown.- Number that's actually a string - you asked for a float cell and got text. That's by design; this node always stringifies. If you need it back as a number, pipe it through
Pandas As Floator the pack'sPy String To Float. - Empty result - a blank
row_index/column_labelmatches nothing. Fill both in.
A small trap worth naming: the pack's example workflows use an older naming scheme, so if a shared workflow references "Pandas Loc Cell Str", that's this node.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| dataframe | DATAFRAME | — | |
| row_index | STRING | — | |
| row_index_type | COMBO | 2 options: string, int | |
| column_label | STRING | — | |
| column_label_type | COMBO | 2 options: string, int |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |