熊猫集过滤器(搜索)

时间:2019-01-31 20:16:53

标签: python pandas

我正在处理从鼠尾草会计中提取的原始数据,基本上是一堆带有详细信息的发票。我的问题是如何根据发票编号列表过滤(最好是压缩新文件)我的CSV文件,然后删除未列出的CSV文件? 这里是我的CSV文件:

CARRIER,DEVISION,WEIGHT,CLIENT,DATE,ITEMS,PRODUCT,VOLUME,NUMBER OF PACKAGES,COMMAND NUMBER,INVOICE NUMBER,CLIENT ADDRESS,ZIP CODE
UPS,DEV PARIS,0,MIROR SABI ,18/01/19,1,EXONERATION TVA ART.262 TER I CGI,0,0,CN1010090,IN1008889,VIA PO 13,20031
UPS,DEV PARIS,0,MIROR SABI ,18/01/19,1,FRAIS DE TRANSPORT / PORT AVANCE,0,0,CN1010090,IN1008889,VIA PO 13,20031
UPS,DEV PARIS,9,MIROR SABI ,18/01/19,1,MIROR SABI  56x51 VIOLET ET VERT,"0,02",1,CN1010090,IN1008889,VIA PO 13,20031
FEDEX,DEV SHANGHAI,0,CONGRES,25/01/19,1,FRAIS DE TRANSPORT/ PORT AVANCE,0,0,CN1008735,IN1008984,15 LOT DU STILETTO,20090
FEDEX,DEV SHANGHAI,17,CONGRES,25/01/19,1,ALOX BOUT DE CANAPE 65X46,"0,25",1,CN1008735,IN1008984,15 LOT DU STILETTO,20090
FEDEX,DEV SHANGHAI,33,CONGRES,25/01/19,1,ALOX TABLE BASSE 110X36,"0,53",1,CN1008735,IN1008984,15 LOT DU STILETTO,20090
DHL,DEV ATLANTA,0,EDWARDS,26/01/19,1,FRAIS D'EMBALLAGE,0,0,CN1010248,IN1009120,DEV ATLANTA,TX 77063
DHL,DEV ATLANTA,0,EDWARDS,27/01/19,1,FRAIS DE TRANSPORT/ PORT AVANCE,0,0,CN1010248,IN1009120,DEV ATLANTA,TX 77063
DHL,DEV ATLANTA,0,EDWARDS,28/01/19,1,MARCHANDISES DESTINEES A,0,0,CN1010248,IN1009120,DEV ATLANTA,TX 77063
DHL,DEV ATLANTA,0,SHOFFNER,29/01/19,1,FRAIS D'EMBALLAGE,0,0,CN1009294,IN1009119,DEV ATLANTA,TX 77063
DHL,DEV ATLANTA,0,SHOFFNER,30/01/19,1,FRAIS DE TRANSPORT/ PORT AVANCE,0,0,CN1009294,IN1009119,DEV ATLANTA,TX 77063
DHL,DEV ATLANTA,0,SHOFFNER,31/01/19,1,MARCHANDISES DESTINEES A,0,0,CN1009294,IN1009119,DEV ATLANTA,TX 77063
DHL,DEV ATLANTA,25,SHOFFNER,01/02/19,1,"Sceptre 32"" Class HD (720P) LED TV�","0,09",1,CN1009294,IN1009119,DEV ATLANTA,TX 77063
DHL,DEV ATLANTA,134,EDWARDS,02/02/19,1,VIRAX TABLE REPAS 200XH74X100,"0,59",2,CN1010248,IN1009120,DEV ATLANTA,TX 77063
FEDEX,DEV MIAMI,0,ALBERTINI GERARD 100106169,25/01/19,1,FRAIS DE TRANSPORT/ PORT AVANCE,0,0,CN1010207,IN1009046,TRANSIT EXPRESS,20620
FEDEX,DEV MIAMI,0,SANTOS MARC 100106157,11/01/19,1,FRAIS DE TRANSPORT/ PORT AVANCE,0,0,CN1010049,IN1008870,TRANSIT EXPRESS,20620
FEDEX,DEV MIAMI,28,SANTOS MARC 100106158,11/01/19,2,IRON TREE TABLE BASSE 70XH26 FIL INOX,"0,32",2,CN1010049,IN1008870,TRANSIT EXPRESS,20620
FEDEX,DEV MIAMI,79,ALBERTINI HELENE 100106169,25/01/19,1,TRAME TABLE BASSE 140X85 CARRARE ET MIROIR OR,"0,58",2,CN1010207,IN1009046,TRANSIT EXPRESS,20620
TNT,DEV BERLIN,0,GEEVE EDDY 102002796PS#2796,26/01/19,1,EXONERATION TVA ART.262 TER I CGI,0,0,CN1010210,IN1009098,INTERIOR HILLS,85609

要解释一下,在每个星期结束时,我必须基于如所附CSV的invoinces数的列表上发送每个载波(DHL,FEDEX,TNT等)的Excel工作表的所有的信息。

我的尝试是:

    df = pd.read_csv("invo.csv", encoding="latin")
    ready_to_ship = ["IN1008889", "IN1009120", "IN1009098"]
    df.filter(ready_to_ship)

    ## I am expecting df result will be filtered with only 
    ## "ready_to_ship" list

1 个答案:

答案 0 :(得分:1)

我们需要查看您所做的工作。您不能只要求某人完成您的所有工作。