This Python script compares two CSV files and identifies any differences between them. It's particularly useful for comparing CSV files with similar data structures.
- Python 3.x
- pandas library (
pip install pandas
)
- Place the script (
compare_csv.py
) in the directory containing the CSV files you want to compare. - Open a terminal or command prompt.
- Navigate to the directory containing the script and CSV files.
- Run the script using the command:
python compare_csv.py
. - Follow the on-screen prompts.
main.py
: The Python script for comparing CSV files.battery1.csv
: Sample CSV file 1 for testing.battery2.csv
: Sample CSV file 2 for testing.
The script will output any differences found between the two CSV files. It will identify the row number (S.No) and the column where the difference occurred, along with the old and new values.
Differences found:
In S.No 1, Operator has been changed from Ramu to Somu
This project is licensed under the MIT License. See the LICENSE file for details.