Skip to main content

No project description provided

Project description

Pretty CSV Diff

pretty-csv-diff is a Python utility that compares two CSV files for differences. It highlights these differences by colorizing them and aligning the columns for easy visual comparison. This tool is particularly useful for data analysts and developers who work with large datasets and need to quickly identify changes between two versions of a CSV file.

Features

  • Color-coded output for easy spotting of differences.
  • Column alignment for improved readability.
  • Command-line interface for easy integration with other tools or scripts.
  • Supports specifying multiple primary keys for comparison.

Installation

To install pretty-csv-diff, clone the repository and run the setup script:

git clone https://github.com/eternity8/pretty-csv-diff.git
cd pretty-csv-diff
pip install .

Usage

The basic command-line syntax for pretty-csv-diff is:

pretty-csv-diff [options] path1 path2 [primary_key ...]
  • path1 and path2 are the file paths to the two CSV files you want to compare.
  • primary_key is either the name or the index of the primary key column(s) in the CSV files. You can specify multiple columns for composite keys.

Example

To compare two CSV files old.csv and new.csv using the column id as the primary key:

pretty-csv-diff old.csv new.csv id

This will output the differences between the two files in your terminal, with < indicating rows that are only in old.csv and > indicating rows that are only in new.csv. Rows present in both files but with differences will be shown side by side for comparison.

Command-Line Example Screenshot

Command-Line Usage

usage: pretty-csv-diff [-h] path path pk [pk ...]

positional arguments:
  path        paths to the two csv files to be compared
  pk          name or index of primary key column. multiple columns are
              allowed

optional arguments:
  -h, --help  show this help message and exit

Contributing

Contributions to pretty-csv-diff are welcome.

License

pretty-csv-diff is released under the Apache License, Version 2.0 (January 2004). See the LICENSE file for more details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pretty-csv-diff-0.1.1.tar.gz (340.5 kB view details)

Uploaded Source

File details

Details for the file pretty-csv-diff-0.1.1.tar.gz.

File metadata

  • Download URL: pretty-csv-diff-0.1.1.tar.gz
  • Upload date:
  • Size: 340.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.10

File hashes

Hashes for pretty-csv-diff-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d201a567d9530fa92ee2c4e727c22ecf8dc90607483446cdf7f8277a776bef7f
MD5 7ab87f15259765c2551488137285e2c9
BLAKE2b-256 57cbfdcb7a7d1f0eab3cb20489de7f5e381f57d486fad533138322df808363d4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page