Nodes/ComfyUI-Data-Analysis/Pandas Transpose
ComfyUI Node

Pandas Transpose

Rows become columns, columns become rows

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

Pandas Transpose rotates a DataFrame 90 degrees: your rows become columns and your columns become rows, the way a spreadsheet's TRANSPOSE works. Afterward, the old column labels are the row index, and the old index labels become the column headers.

When is flipping a table actually useful in a ComfyUI data workflow? Mostly when a dataset shows up in the wrong orientation. Plenty of real-world CSVs store variables as rows and observations as columns (wide data, survey dumps, transpose-happy exports), and every plotting node in this pack - and most stats nodes, which operate per column - assumes variables run down the columns. So the fix is often one transpose away: flip the frame, and suddenly Pandas Summary and the plot nodes behave. It also rescues wide DataFrames that pandas' text repr was truncating, since a transposed frame may print fully.

How it works

It's dataframe.transpose(), a genuine flip rather than a reshape. Two things to keep in mind, both inherited from pandas: transposing a frame with mixed column dtypes will coerce the result to a single dtype (usually object), because the columns now contain the old rows' mixed values; and the index/column names come along for the ride, which is usually what you want for readability.

Inputs and outputs

  • dataframe (DATAFRAME) - the frame to flip.

Output: a single DATAFRAME, transposed. Wire it onward exactly as you would the original - the type doesn't change, just the orientation.

Installing this pack

This node ships in ComfyUI-Data-Analysis by Hide Inada (HowToSD). CPU-only, no GPU, no model downloads - but the pack needs its Python stack, which stock ComfyUI lacks: pandas, matplotlib, seaborn, scipy, scikit-learn, openpyxl, lxml.

ComfyUI Manager: Manager → Custom Node Manager → search "Data analysis" → install ComfyUI-Data-Analysis → restart ComfyUI and refresh the browser. Manager installs the deps.

Git clone:

cd ComfyUI/custom_nodes
git clone https://github.com/HowToSD/ComfyUI-Data-Analysis.git
mv ComfyUI-Data-Analysis data-analysis   # example workflows depend on this folder name
pip install -r data-analysis/requirements.txt

Restart ComfyUI after installing.

Troubleshooting

  • Numbers became text. That's the mixed-dtype coercion doing its thing - a frame with a string column transposed into a single-dtype frame becomes all-object. Convert the string column to numeric before transposing if that matters.
  • Nothing changed? Look again - labels swap too, so a square-ish frame can look deceptively similar. Check the index vs column headers with Pandas Show DataFrame.
  • Wrong axis of confusion. Transpose is the full 90° flip. If you wanted to pivot or reshape rather than flip, that's Pandas Pivot or Pandas Melt - different tools.
CategoryData Analysis

Inputs (1)

NameTypeDefaultDescription
dataframeDATAFRAME

Outputs (1)

NameTypeDescription
DATAFRAMEDATAFRAME