Added Pandas Load CSV With Encoding node to support non-utf-8 files

This commit is contained in:
HowToSD
2025-02-15 11:44:24 -08:00
parent 71319b98d4
commit a998c158c3
3 changed files with 11 additions and 7 deletions
+5 -2
View File
@@ -9,6 +9,7 @@ from .modules.pandas_wrapper.pandas_head import PandasHead
from .modules.pandas_wrapper.pandas_index import PandasIndex
from .modules.pandas_wrapper.pandas_join import PandasJoin
from .modules.pandas_wrapper.pandas_load_csv import PandasLoadCSV
from .modules.pandas_wrapper.pandas_load_csv_with_encoding import PandasLoadCSVWithEncoding
from .modules.pandas_wrapper.pandas_load_csv_with_index import PandasLoadCSVWithIndex
from .modules.pandas_wrapper.pandas_loc_cell_str import PandasLocCellStr
from .modules.pandas_wrapper.pandas_loc_row_series import PandasLocRowSeries
@@ -35,6 +36,7 @@ NODE_CLASS_MAPPINGS: Dict[str, Type[T]] = {
"PandasIndex": PandasIndex,
"PandasJoin": PandasJoin,
"PandasLoadCSV": PandasLoadCSV,
"PandasLoadCSVWithEncoding": PandasLoadCSVWithEncoding,
"PandasLoadCSVWithIndex": PandasLoadCSVWithIndex,
"PandasLocCellStr": PandasLocCellStr,
"PandasLocRowSeries": PandasLocRowSeries,
@@ -59,12 +61,13 @@ NODE_DISPLAY_NAME_MAPPINGS: Dict[str, str] = {
"MPLScatter": "MPL Scatter Plot",
"PandasColumns": "Pandas Columns",
"PandasCreate": "Pandas Create",
"PandasCreateWithIndex": "Pandas Create with Index",
"PandasCreateWithIndex": "Pandas Create With Index",
"PandasHead": "Pandas Head",
"PandasIndex": "Pandas Index",
"PandasJoin": "Pandas Join",
"PandasLoadCSV": "Pandas Load CSV",
"PandasLoadCSVWithIndex": "Pandas Load CSV with Index",
"PandasLoadCSVWithEncoding": "Pandas Load CSV With Encoding",
"PandasLoadCSVWithIndex": "Pandas Load CSV With Index",
"PandasLocCellStr": "Pandas Loc Cell Str",
"PandasLocRowSeries": "Pandas Loc Row Series",
"PandasSaveCSV": "Pandas Save CSV",
+5 -4
View File
@@ -14,10 +14,11 @@ You can right-click, select **Add Node**, go to **Data Analysis**, and look for
| Node Name | Functionality |
|-------------------------|-------------------------------------|
| **Pandas Load CSV** | Load a CSV file |
| **Pandas Load CSV with Index** | Load a CSV file containing index |
| **Pandas Load CSV With Encoding** | Load a CSV file not encoded in utf-8 |
| **Pandas Load CSV With Index** | Load a CSV file containing index |
| **Pandas Save CSV** | Save a DataFrame to a CSV file |
| **Pandas Create** | Create a DataFrame from CSV text field |
| **Pandas Create with Index** | Create a DataFrame from CSV text field containing index |
| **Pandas Create With Index** | Create a DataFrame from CSV text field containing index |
| **Pandas Columns** | Extract column labels |
| **Pandas Index** | Extract row labels (index) |
| **Pandas Select Columns** | Select specific columns from a DataFrame |
@@ -41,10 +42,10 @@ A faster way is to double-click the canvas to open the node search dialog.
The examples directory contains workflows that load data from an example dataset included in this package. These workflows should give you a good idea about how to use these nodes.
## Loading data
Use **Pandas Load CSV** node to load a CSV, or **Pandas Load CSV with Index** node if the CSV contains an index column.
Use **Pandas Load CSV** node to load a CSV, or **Pandas Load CSV With Index** node if the CSV contains an index column. These nodes assume that the file is encoded in utf-8. If the file is not encoded in utf-8, use **Pandas Load CSV With Encoding** to specify the encoding of the file. This is necessary if the data was collected before utf-8 encoding became popular. For example, you can try "latin_1" for a file that contains accented characters in the US and Western Europe.
![Pandas Load CSV node](images/load.jpg)
This will emit the DataFrame in a JSON string.
These nodes emit the DataFrame in a JSON string.
CSV file path is relative to the ComfyUI installation directory unless you specify the absolute file path.
## Saving data
+1 -1
View File
@@ -1,7 +1,7 @@
[project]
name = "data-analysis"
description = "Data analysis custom modules for ComfyUI - Use Pandas & Matplotlib within ComfyUI"
version = "1.0.10"
version = "1.0.11"
license = {file = "LICENSE"}
[project.urls]