Pandas Strftime
Turn datetime columns into pretty strings
- dataframe
- DATAFRAME
Dates are the most annoying data type in any analysis, and this pack gives you two nodes to fight them: Pandas To Datetime (strings in) and Pandas Strftime (nice strings out). Strftime takes one or more columns that are already real datetime columns and reformats them as text - turning an ISO timestamp like 2024-07-15 00:00:00 into July 15, 2024 or whatever pattern you ask for.
It's a formatting node, the display half of the date story. You'd use it when a datetime column is about to hit something that wants text - a chart label, a Pandas To String pass, or just a Pandas Show DataFrame where you don't want the raw timestamp clutter. It pairs naturally with Pandas To Datetime in the same pack: parse first, format later.
How it works
You give it a comma-separated list of column names and a strftime format string. The implementation copies the frame, then for each named column checks is_datetime64_any_dtype - if the column is genuinely datetime, it applies col.dt.strftime(date_format); if not, the column passes through untouched. That guard is a small kindness: name a non-date column and it won't crash, it'll just leave that column alone.
The format string uses Python's strftime codes - %Y for four-digit year, %m for zero-padded month, %d for day, %b for abbreviated month name, and so on. The author links the official Python datetime docs from the node docstring; keep that tab open.
Inputs and outputs
dataframe(DATAFRAME) - the frame containing the datetime columns.column_names(STRING, default empty) - comma-separated, exact names:date,reported_at. Same pickiness as every column-name field in this pack.date_format(STRING, default empty) - the strftime pattern, e.g.%Y-%m-%dor%B %d, %Y.
Output: a single DATAFRAME with the named columns reformatted as strings.
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.
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
- Nothing changed in my column. Either the column wasn't a real datetime dtype (run
Pandas To Datetimeon it first) or the name you typed doesn't match. Both are silent no-ops here. - I get a ValueError about the format. The format string is invalid or the column is full of values it can't match. Double-check your
%codes against the Python strftime reference. - Column names must be exact.
column_namesis a comma-separated string, not a dropdown - a typo means that column quietly doesn't get formatted.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| dataframe | DATAFRAME | — | |
| column_names | STRING | — | |
| date_format | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| DATAFRAME | DATAFRAME | — |