Skip to content

northtorch/format-data-diff

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

format-data-diff

Format result of data-diff (JSON) to csv

USAGE

python python format-data-diff.py <input_file> <output_file>

SAMPLE

Single Column

  • Input

    ["-", ["001", "78"]]
    ["+", ["001", "0"]]
    ["-", ["002", "85"]]
    ["+", ["002", "77"]]
    ["-", ["003", "76"]]
    ["+", ["003", "0"]]
    ["-", ["004", "64"]]
    ["+", ["004", "0"]]
    ["-", ["005", "62"]]
    ["+", ["006", "54"]]
    
  • Output

    key,before_0,after_0
    001,78,0
    002,85,77
    003,76,0
    004,64,0
    005,62,-1
    006,-1,54
    

Multiple Columns

  • Input

    ["-", ["001", "78", "A"]]
    ["+", ["001", "0", "B"]]
    ["-", ["002", "85", "A"]]
    ["+", ["002", "77", "A"]]
    ["-", ["003", "76", "B"]]
    ["+", ["003", "0", "B"]]
    ["-", ["004", "64", "C"]]
    ["+", ["004", "0", "C"]]
    ["-", ["005", "62", "A"]]
    ["+", ["006", "54", "A"]]
    
  • Output

    key,before_0,after_0,before_1,after_1
    001,78,0,A,B
    002,85,77,A,A
    003,76,0,B,B
    004,64,0,C,C
    005,62,-1,A,-1
    006,-1,54,-1,A
    

About

Format result of data-diff (JSON) to csv

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages