csv compare
v1.0.3
CSVCOMPARETOOL을 사용하면 지정된 열 식별자를 기반으로 두 CSV 파일간에 차이점을 찾을 수 있습니다. 두 CSV 파일의 내용을 비교하고 한 파일에 존재하지만 다른 파일에는 어떤 레코드가 있는지 식별하는 간단한 방법을 제공합니다.
메모
차이를 위해 CSV 파일을 비교할 때는 CSV에 더 많은 항목을 두 번째로 제공하십시오. 예를 들어, CSV-1에 34 개의 이름 목록이 있고 CSV-2가 40 목록이있는 경우, 차이가 예상대로 표시되기 위해 두 번째 전달 된 CSV 경로로 CSV-2를 설정해야합니다.
pip 사용하여 CSV 컴파리를 설치할 수 있습니다.
pip install csv-compare-toolPython 프로젝트에서 CSV 컴퓨터를 사용하려면 다음 단계를 따르십시오.
중요한
Python 프로젝트에서 패키지로 가져 오는 경우, 패키지가 csvcomparetool 읽도록 하이픈을 제거 해야합니다 (자세한 내용은 PEP 8 참조)
import csvcomparetool 선택적으로 CSVComparer 클래스 만 가져올 수 있습니다
from csvcomparetool import CSVComparerCSVComparer 객체를 만듭니다 csv1_path = "path/to/first.csv"
csv2_path = "path/to/second.csv"
column = "identifier_column"
comparer = CSVComparer ( csv1_path , csv2_path , column ) if not comparer . validate_paths ():
print ( "CSV file paths are invalid. Please check the file paths and try again." )
return if not comparer . validate_columns ():
print ( "Provided column not found in CSV. Check the columns and try again." )
return differences = comparer . find_differences () for difference in differences :
print ( f"Record ' { difference } ' is present in CSV2 but not in CSV1." ) from csvcomparetool import CSVComparer
csv1_path = "path/to/first.csv"
csv2_path = "path/to/second.csv"
column = "identifier_column"
comparer = CSVComparer ( csv1_path , csv2_path , column )
if not comparer . validate_paths () or not comparer . validate_columns ():
print ( "CSV file paths are invalid, or the column identifier does not exist. Check the file paths and columns and try again." )
else :
differences = comparer . find_differences ()
for difference in differences :
print ( f"Record ' { difference } ' is present in CSV2 but not in CSV1." )먼저이 저장소를 컴퓨터의 로컬 디렉토리로 복제하십시오.
git clone https://github.com/liquidz00/csv-compare.git복제 된 리포지션 위치 (저장소를 저장하기로 선택한 로컬 디렉토리)로 이동하십시오.
cd /path/to/repo/src/csvcomparetool/마지막으로 다음 명령을 실행하십시오
python cli.py /csv/path/one /csv/path/two columnidentifier