Nodes/ComfyUI-Data-Analysis/Pandas As String
ComfyUI Node

Pandas As String

Flatten the whole table to text in one pass

By HowToSD·Created 2 years ago·Updated about a year ago· 23
Pandas As String
  • dataframe
  • DATAFRAME

Pandas As String converts every cell in a DataFrame to text. It's the mirror image of Pandas As Float and Pandas As Int: where those force the whole table numeric, this forces the whole table string. Sounds trivial until you need it - the moment you want to export a table, build text out of values, or compare things that only make sense as strings, this is the node.

How it works

It's a single dataframe.astype(str) under the hood. Every cell becomes its string representation: 10 becomes "10", 10.5 becomes "10.5", None becomes "None", and datetimes become whatever pandas' default string format is for them. Nothing errors, nothing is dropped - it's a pure cast.

The important consequence: this is a one-way street for numbers. Once a cell is "10", it's text, and arithmetic nodes will refuse to add to it. So the ordering matters - do your numeric work first, and reach for As String at the end of a branch, right before you display, save, or export the frame.

Inputs and outputs

  • dataframe - the frame to convert (DATAFRAME)
  • Output: a DATAFRAME with every cell as a string

Minimal node, as most of these are: one input, one output.

When you'd actually want it

Realistically: right before Pandas Save CSV or a text export when you want zero reformatting surprises; when you're building labels or prompt text from table values (grab a row, stringify it, feed it to a text/prompt node); or when you're mixing numbers and text in one column and want them comparable. It's also a good debugging tool - stringify a frame to eyeball exactly what's inside, because string output never hides a dtype.

Installing it

Part of ComfyUI-Data-Analysis (author Hide Inada / HowToSD.com). Manager: search Data Analysis → install → restart. Manual:

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 needed; pandas comes from requirements.txt.

The one trap

None becomes the string "None", not an empty string or NaN. If you're counting missing values after stringifying, you'll see a column full of "None" and may mistake it for data. And remember the direction: once stringified, numeric nodes will reject that frame, so don't run As String in the middle of a numeric pipeline - put it at the end.

CategoryData Analysis

Inputs (1)

NameTypeDefaultDescription
dataframeDATAFRAME

Outputs (1)

NameTypeDescription
DATAFRAMEDATAFRAME