如何从csv B中获取列作为键从csv A中获取列

时间:2018-09-06 08:13:03

标签: command-line csvkit

我试图通过将其映射到国家CSV数据库districtname来更正A.csv中的B.csv

这是我的A.csv

的内容
"Series","No","districtname","PinCode"
"A","101","Mysuru","570010"
"A","103","D. K. ","574216"
"A","104","Bengaluru","560004"
"A","105","Bengaluru","560010"
"A","106","Doddaballapura","561203"
"A","107","Bengaluru","560002"
"A","109","Bengaluru","560050"
"A","110","Bengaluru","560076"
"A","111","Tumkur ","572112"

B.csv

的内容
PinCode,districtname
744112,South Andaman
744101,South Andaman
744103,South Andaman
744104,South Andaman
744201,North And Middle Andaman
744107,South Andaman
744302,Nicobar
744301,Nicobar
744202,North And Middle Andaman
...……

如何使用PinCode中的A.csv列作为查找B.csv中提到的正式区名称的键

csvkit命令行方法将很有帮助。

1 个答案:

答案 0 :(得分:0)

csvjoin -I --left -c 4,1 fil1.csv file2.csv