csv-diff
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCSV Diff
CSV 差异对比
Compare two CSV files to identify changes, additions, or deletions between them and generate a unified diff output similar to .
git diff比较两个CSV文件,识别它们之间的修改、新增或删除内容,并生成类似的统一diff输出。
git diffWhen to use
适用场景
Use this when you need to:
- Compare two CSV files and see what changed between them, especially for large datasets.
- Generate a unified diff file for tracking changes in tabular data.
当你需要以下操作时使用:
- 比较两个CSV文件并查看它们之间的变化,尤其是针对大型数据集。
- 生成统一diff文件以跟踪表格数据的变化。
Quick start
快速开始
Compare two CSV files:
bash
csvdiff old.csv new.csvThis will generate a file showing the differences.
result.diff比较两个CSV文件:
bash
csvdiff old.csv new.csv这将生成一个显示差异的文件。
result.diffDocumentation
文档
- Run to see available options and usage.
csvdiff --help - Read the documentation for more details.
- 运行查看可用选项和使用方法。
csvdiff --help - 阅读文档了解更多详细信息。
Output
输出结果
The tool generates a unified diff output similar to the following:
diff
--- old.csv
+++ new.csv
@@ -2,3 +2,3 @@
0,Alice,70000
-1,John,50000
+1,John,55000
2,Jane,60000The output shows:
- Lines prefixed with were removed or changed
- - Lines prefixed with were added or changed
+ - Context lines (no prefix) show unchanged data for reference
该工具生成如下所示的统一diff输出:
diff
--- old.csv
+++ new.csv
@@ -2,3 +2,3 @@
0,Alice,70000
-1,John,50000
+1,John,55000
2,Jane,60000输出内容说明:
- 以开头的行表示被删除或修改的内容
- - 以开头的行表示被新增或修改的内容
+ - 无前缀的上下文行显示未更改的数据,供参考
Notes
注意事项
- CSV files must have a header row.
- Output is saved to a file (default:
.diff).result.diff
- CSV文件必须包含表头行。
- 输出结果保存到文件中(默认文件名为
.diff)。result.diff
Requirements
环境要求
The package must be installed in your environment. You can install it globally via (or user-preferred python package manager):
csv-diff-pyuvbash
uv tool install csv-diff-pyAlternatively, run it directly with (or user-preferred python package runner):
uvxbash
uvx --from csv-diff-py csvdiff file1.csv file2.csv环境中必须安装包。你可以通过(或你偏好的Python包管理器)全局安装它:
csv-diff-pyuvbash
uv tool install csv-diff-py或者,使用(或你偏好的Python包运行器)直接运行:
uvxbash
uvx --from csv-diff-py csvdiff file1.csv file2.csv