根据数据框中另一列中的值在数据框中应用lambda

时间:2017-06-08 23:11:51

标签: python pandas lambda



Sample_ID,Method,Sample Type,NaX,NaU,MgX,MgU,AlX,AlU,SiX,SiU,PX,PU,SX,SU,ClX,ClU,ArX,ArU,KX,KU,CaX,CaU,ScX,ScU,TiX,TiU,VX,VU,CrX,CrU,MnX,MnU,FeX,FeU,CoX,CoU,NiX,NiU,CuX,CuU,ZnX,ZnU,GaX,GaU,GeX,GeU,AsX,AsU,SeX,SeU,BrX,BrU,RbX,RbU,SrX,SrU,MoX,MoU,AgX,AgU,CdX,CdU,SnX,SnU,SbX,SbU,TeX,TeU,IX,IU,CsX,CsU,BaX,BaU,LaX,LaU,CeX,CeU,SmX,SmU,WX,WU,HgX,HgU,PbX,PbU,BiX,BiU
16-8-211,Method 5,NO,6270,120,41970,140,107500,100,237400,200,319.7,3.3,12130,10,1166,3,,,9364,58,423400,300,0,0,13420,40,67,21,365.3,7.3,565.3,5.9,21350,70,< 3.0,0,238.9,8.6,285.3,8.8,285.4,7.6,339.2,8.6,< 0.5,0,127.6,6,< 0.5,0,54.5,4.5,172,5.3,2569,13,< 1.0,0,< 2.0,0,< 2.0,0,< 4.0,0,< 4.0,0,< 5.1,0,< 4.0,0,< 4.0,0,< 2.0,0,180,14,887,20,0,0,< 1.0,0,< 1.0,0,315,14,< 1.0,0
16-8-255,Method 5,NO,4280,120,47760,150,123200,100,273100,200,326.5,3.4,6148,9,1239,3,,,9545,59,471700,400,0,0,15000,50,92,22,327.7,7.5,614.6,6.1,22790,70,< 3.0,0,243.9,8.7,294.2,8.8,287.7,7.5,391.5,8.6,< 0.5,0,124.7,6.4,5.9,4.6,20.6,4.3,204.1,5.4,2923,14,< 1.0,0,< 2.0,0,< 2.0,0,< 4.0,0,< 4.0,0,< 5.1,0,< 4.0,0,< 4.0,0,< 2.0,0,266,20,1031,22,0,0,< 1.0,0,< 1.0,0,423,14,< 1.0,0
286,Method 5,NO,< 101,0,13730,140,11870,60,373100,300,5792,14,76820,60,15170,20,,,153400,200,29930,90,19,19,422.8,9.3,49.9,5.9,72.3,3.3,2358,11,3093,22,< 3.0,0,212.5,7.8,237.9,8.1,2010,15,221.8,7.2,< 0.5,0,22.7,3.8,< 0.5,0,110,4.7,671,7.4,255.2,6.3,< 1.0,0,< 2.0,0,< 2.0,0,< 4.0,0,< 4.0,0,< 5.1,0,< 4.0,0,< 4.0,0,< 2.0,0,< 2.0,0,< 2.0,0,0,0,< 1.0,0,< 1.0,0,71,8.7,< 1.0,0
287,Method 5,NO,< 101,0,26960,160,21060,70,112800,100,6708,13,111500,100,16500,20,,,127300,200,262200,200,0,0,2860,19,293,10,16,5.5,11510,30,28330,80,< 3.0,0,258.7,8.6,591,11,4091,21,185.9,7.9,< 0.5,0,60.6,5.1,< 0.5,0,58.2,4.6,756.8,7.9,2360,13,< 1.0,0,< 2.0,0,< 2.0,0,< 4.0,0,< 4.0,0,< 5.1,0,< 4.0,0,< 4.0,0,< 2.0,0,< 2.0,0,367,12,0,0,< 1.0,0,< 1.0,0,174,11,< 1.0,0
289,Method 5,NO,< 101,0,35150,210,23100,80,24230,40,8474,17,183200,100,25210,20,,,266400,300,611600,500,360,120,1502,35,145,17,388.5,8.3,34320,50,173500,200,< 3.0,0,622,13,2927,21,25220,50,294,11,< 0.5,0,747,15,13.8,6.8,533.5,9,4364,18,15560,30,< 1.0,0,< 2.0,0,< 2.0,0,< 4.0,0,< 4.0,0,< 5.1,0,< 4.0,0,< 4.0,0,63000,11000,< 2.0,0,< 2.0,0,0,0,< 1.0,0,< 1.0,0,2521,32,< 1.0,0
290,Method 5,NO,1210,170,373,85,3952,51,505500,300,347.7,4.5,49590,40,101.2,1.6,,,78480,140,3155,39,38.9,8.7,132.6,5.8,20.1,4.3,72.2,2.9,316.1,4.1,1901,15,< 3.0,0,231.9,7.7,370,8.7,3229,19,195.1,7.2,< 0.5,0,20.4,4.6,< 0.5,0,< 0.5,0,313.1,5.8,52.7,5.1,< 1.0,0,< 2.0,0,< 2.0,0,< 4.0,0,< 4.0,0,< 5.1,0,< 4.0,0,< 4.0,0,< 2.0,0,< 2.0,0,< 2.0,0,0,0,< 1.0,0,< 1.0,0,192.8,9.8,< 1.0,0
332,Method 201,NO,9470,230,2680,110,6257,55,372700,300,1836,8,79200,60,19720,20,,,112400,200,21000,70,38,21,618,10,32.8,6,93.3,3.4,1118,7,3031,21,< 3.0,0,213.1,7.7,454.1,9.1,5467,24,175.8,7.6,< 0.5,0,< 0.5,0,< 0.5,0,305.6,6.1,315.6,6.2,252.9,6.1,< 1.0,0,< 2.0,0,< 2.0,0,< 4.0,0,< 4.0,0,< 5.1,0,< 4.0,0,< 4.0,0,< 2.0,0,< 2.0,0,< 2.0,0,0,0,< 1.0,0,< 1.0,0,297,10,< 1.0,0
332_Repeat,Method 201,NO,8940,230,2690,110,6199,55,383500,300,1754,8,74770,60,18430,20,,,106700,200,19850,70,43,20,595,10,33.1,6,94.8,3.4,1059,7,2821,20,< 3.0,0,190.8,7.6,408.4,9.1,5066,23,181.2,7.6,< 0.5,0,39.5,5.1,< 0.5,0,283.6,6,300.6,6.1,249.4,6.1,< 1.0,0,< 2.0,0,< 2.0,0,< 4.0,0,< 4.0,0,< 5.1,0,< 4.0,0,< 4.0,0,< 2.0,0,< 2.0,0,< 2.0,0,0,0,< 1.0,0,< 1.0,0,215,11,< 1.0,0
346,Method 201,NO,10470,260,2500,120,7004,56,253300,200,2586,10,115400,100,27950,20,,,179900,200,34100,90,43,27,1417,15,46.8,8,132.3,4,1948,10,5106,29,< 3.0,0,196,7.7,757,11,11780,30,235.8,8.1,< 0.5,0,16.2,6.9,< 0.5,0,569.3,7.5,603.2,7.7,505.6,7.3,< 1.0,0,< 2.0,0,< 2.0,0,< 4.0,0,< 4.0,0,< 5.1,0,< 4.0,0,< 4.0,0,< 2.0,0,< 2.0,0,< 2.0,0,0,0,< 1.0,0,< 1.0,0,676,13,< 1.0,0
347,Method 201,NO,2740,160,1530,79,4799,51,521200,300,530.8,4.5,18630,20,6888,10,,,29380,80,5372,36,30,11,212.1,6.2,18.7,4.3,55.9,2.9,305.3,4.4,1583,13,< 3.0,0,213.7,7.5,261,8.1,1999,15,208.8,7.3,< 0.5,0,7.4,4.1,< 0.5,0,54.1,4.3,87.9,4.6,62.1,5.2,< 1.0,0,< 2.0,0,< 2.0,0,< 4.0,0,< 4.0,0,< 5.1,0,< 4.0,0,< 4.0,0,< 2.0,0,< 2.0,0,< 2.0,0,0,0,< 1.0,0,< 1.0,0,107.3,8.8,< 1.0,0
348,Method 201,NO,5260,190,1749,91,5506,53,448400,300,1143,6,46190,40,11410,10,,,62430,130,11360,50,34,15,478,8.7,22.5,5.4,85.7,3.1,701.3,5.9,2486,18,< 3.0,0,199.2,7.6,355.5,8.8,4833,22,208.3,7.6,< 0.5,0,19.8,4.8,< 0.5,0,189.9,5.3,210.7,5.4,146.1,5.7,< 1.0,0,< 2.0,0,< 2.0,0,< 4.0,0,< 4.0,0,< 5.1,0,< 4.0,0,< 4.0,0,< 2.0,0,< 2.0,0,< 2.0,0,0,0,< 1.0,0,< 1.0,0,211,10,< 1.0,0
348_Repeat,Method 201,NO,5510,190,1795,91,5486,53,447600,300,1138,6,46470,40,11440,10,,,62590,130,11420,50,46,15,480.6,8.7,24.5,5.4,84.4,3.1,711.3,6,2417,18,< 3.0,0,198.9,7.6,359,8.8,4753,22,194.4,7.5,< 0.5,0,31.2,4.7,< 0.5,0,187.3,5.3,194.3,5.4,156.4,5.7,< 1.0,0,< 2.0,0,< 2.0,0,< 4.0,0,< 4.0,0,< 5.1,0,< 4.0,0,< 4.0,0,< 2.0,0,< 2.0,0,< 2.0,0,0,0,< 1.0,0,< 1.0,0,174,10,< 1.0,0
402,Method 5,NO,< 101,0,1436,66,4471,47,538700,300,340.3,3.5,< 2.0,0,4135,7,,,1396,18,3921,26,33.6,9.1,668.9,9.7,3.9,3.9,593.2,6.7,513.1,5.8,9716,42,< 3.0,0,604,10,178.9,7.6,159,6,202.5,6.9,< 0.5,0,< 0.5,0,< 0.5,0,96.7,4.5,3.3,3.3,46.2,4.9,< 1.0,0,< 2.0,0,< 2.0,0,< 4.0,0,< 4.0,0,< 5.1,0,< 4.0,0,< 4.0,0,< 2.0,0,< 2.0,0,< 2.0,0,0,0,< 1.0,0,< 1.0,0,< 1.0,0,< 1.0,0
403,Method 5,NO,< 101,0,923,66,4436,48,583800,400,117.6,2.8,< 2.0,0,310.9,1.9,,,725,13,666,11,28.8,4.5,54.8,3.7,13.6,3.5,95.4,3.2,52.7,2.7,1108,10,< 3.0,0,211.4,7.5,147.6,7.3,80,5.2,207.6,7,< 0.5,0,< 0.5,0,< 0.5,0,< 0.5,0,3.3,3.3,< 0.5,0,< 1.0,0,< 2.0,0,< 2.0,0,< 4.0,0,< 4.0,0,< 5.1,0,< 4.0,0,< 4.0,0,< 2.0,0,< 2.0,0,< 2.0,0,0,0,< 1.0,0,< 1.0,0,< 1.0,0,< 1.0,0
407,Method 5,NO,154200,400,< 20,0,1673,29,113000,100,369,3.9,89760,60,17820,20,,,63290,130,1012,30,42,5.3,61.2,3.8,15.1,3.6,57,2.5,187.6,3.2,980.9,9,< 3.0,0,185,7.3,140.9,7.5,136.8,5.9,209,6.9,< 0.5,0,< 0.5,0,< 0.5,0,245.4,5.5,808.2,8.1,18.3,5,< 1.0,0,< 2.0,0,< 2.0,0,< 4.0,0,< 4.0,0,< 5.1,0,< 4.0,0,< 4.0,0,< 2.0,0,< 2.0,0,< 2.0,0,0,0,< 1.0,0,< 1.0,0,< 1.0,0,< 1.0,0
408,Method 5,NO,167200,400,< 20,0,1608,28,77260,70,405.1,4,97590,70,16150,10,,,96510,160,1091,36,42.3,5.6,63.8,4,14.3,3.7,56.5,2.5,263,3.8,963.3,8.9,< 3.0,0,176.4,7.5,156.3,7.8,200.8,6.5,218.7,7.1,< 0.5,0,< 0.5,0,< 0.5,0,321.4,6,1104,9,< 0.5,0,< 1.0,0,< 2.0,0,< 2.0,0,< 4.0,0,< 4.0,0,< 5.1,0,< 4.0,0,< 4.0,0,< 2.0,0,< 2.0,0,< 2.0,0,0,0,< 1.0,0,< 1.0,0,< 1.0,0,< 1.0,0
409,Method 5,NO,177700,400,< 20,0,1402,24,43440,40,349.3,3.7,84900,60,17800,20,,,83140,150,1218,34,36,5.6,58.7,3.8,21,3.7,54.1,2.5,280.1,3.8,1011,9,< 3.0,0,210,7.3,165.6,7.5,169.9,6.1,195.5,7.2,< 0.5,0,< 0.5,0,< 0.5,0,284,5.9,960,8.7,4.8,4.8,< 1.0,0,< 2.0,0,< 2.0,0,< 4.0,0,< 4.0,0,< 5.1,0,< 4.0,0,< 4.0,0,< 2.0,0,< 2.0,0,< 2.0,0,0,0,< 1.0,0,< 1.0,0,< 1.0,0,< 1.0,0
427,Method 201,NO,< 101,0,3484,75,5093,48,529000,300,560,4.2,8235,12,410.3,2.2,,,17940,70,8568,42,14,13,118.3,5,12.4,3.9,61.3,2.9,299.5,4.3,1162,10,< 3.0,0,179.9,7.2,158.9,7.4,468.2,8.1,207.3,6.9,< 0.5,0,< 0.5,0,< 0.5,0,12.9,3.8,68.5,4.3,75.9,5.2,< 1.0,0,< 2.0,0,< 2.0,0,< 4.0,0,< 4.0,0,< 5.1,0,< 4.0,0,< 4.0,0,< 2.0,0,< 2.0,0,< 2.0,0,0,0,< 1.0,0,< 1.0,0,< 1.0,0,< 1.0,0
427_Repeat,Method 201,NO,< 101,0,3598,76,5096,48,529900,300,557.8,4.2,8312,12,410.2,2.2,,,18060,70,8584,42,21,13,115.9,5,8.5,3.9,59.4,2.9,296.8,4.3,1149,10,< 3.0,0,183.7,7.2,149.4,7.3,444.5,7.9,204.5,6.9,< 0.5,0,< 0.5,0,< 0.5,0,4.1,3.6,65.5,4.3,63.4,5.1,< 1.0,0,< 2.0,0,< 2.0,0,< 4.0,0,< 4.0,0,< 5.1,0,< 4.0,0,< 4.0,0,< 2.0,0,< 2.0,0,< 2.0,0,0,0,< 1.0,0,< 1.0,0,< 1.0,0,< 1.0,0
428,Method 201,NO,3410,140,5602,86,7590,56,562600,300,794.2,5,5873,10,763.8,3.1,,,12630,60,16280,60,79,18,351.5,8.6,43.9,5.5,47,3.2,329.4,4.6,1475,12,< 3.0,0,197.5,7.5,148.8,7.6,358.6,7.5,223.6,7,< 0.5,0,< 0.5,0,< 0.5,0,7.6,3.9,48.1,4.4,84.3,5.7,< 1.0,0,< 2.0,0,< 2.0,0,< 4.0,0,< 4.0,0,< 5.1,0,< 4.0,0,< 4.0,0,< 2.0,0,< 2.0,0,< 2.0,0,0,0,< 1.0,0,< 1.0,0,8.3,7.3,< 1.0,0
429,Method 201,NO,< 101,0,3977,78,5107,49,530300,300,594.6,4.3,9780,13,407.7,2.2,,,20300,70,10320,50,15,14,130.9,5.1,10.8,3.9,101.7,3.4,367.5,4.8,1429,12,< 3.0,0,190.9,7.3,158.6,7.4,510.9,8.4,211.5,6.9,< 0.5,0,< 0.5,0,< 0.5,0,6.5,3.7,76.7,4.3,88.3,5.2,< 1.0,0,< 2.0,0,< 2.0,0,< 4.0,0,< 4.0,0,< 5.1,0,< 4.0,0,< 4.0,0,< 2.0,0,< 2.0,0,< 2.0,0,0,0,< 1.0,0,< 1.0,0,< 1.0,0,< 1.0,0
430,Method 201,NO,3530,140,5626,88,7944,57,559800,300,899,5.3,7983,12,773.9,3.1,,,18840,70,16370,60,20,18,70,11,15.6,5.9,60.3,3.1,323.3,4.7,1587,13,< 3.0,0,180.3,7.7,151.9,7.8,458.1,8.2,216.4,7.2,< 0.5,0,< 0.5,0,< 0.5,0,22.1,4.1,71.2,4.5,72.2,5.7,< 1.0,0,< 2.0,0,< 2.0,0,< 4.0,0,< 4.0,0,< 5.1,0,< 4.0,0,< 4.0,0,2900,2600,< 2.0,0,< 2.0,0,0,0,< 1.0,0,< 1.0,0,3.8,3.8,< 1.0,0
447,Method 201,NO,139200,300,< 20,0,2473,27,135200,100,432.2,3.3,49710,40,8907,9,,,56620,120,5353,40,54,11,87.6,4.5,12.4,4.1,836.6,7.9,270.7,5,4346,26,< 3.0,0,961,12,158.1,8,235.2,6.7,207.7,7.1,< 0.5,0,< 0.5,0,< 0.5,0,311.9,6,1072,9,35.4,5.5,< 1.0,0,2883,84,< 2.0,0,< 4.0,0,< 4.0,0,< 5.1,0,< 4.0,0,< 4.0,0,< 2.0,0,< 2.0,0,< 2.0,0,0,0,< 1.0,0,< 1.0,0,< 1.0,0,< 1.0,0
447_Repeat,Method 201,NO,138900,300,< 20,0,2504,26,135400,100,440.3,3.3,49420,40,8871,9,,,56840,120,5320,40,45,11,93.8,4.6,18.2,4.1,829.3,7.9,273.9,5,4290,26,< 3.0,0,949,12,162.6,7.9,238.3,6.9,206.7,7.3,< 0.5,0,< 0.5,0,< 0.5,0,307.5,6,1058,9,36,5.4,< 1.0,0,2852,83,< 2.0,0,< 4.0,0,< 4.0,0,< 5.1,0,< 4.0,0,< 4.0,0,< 2.0,0,< 2.0,0,< 2.0,0,0,0,< 1.0,0,< 1.0,0,< 1.0,0,< 1.0,0
448,Method 201,NO,141900,400,< 20,0,1829,26,73970,60,419.7,3.7,79670,50,13920,10,,,90230,150,4396,43,50,11,73.1,4.2,17.9,3.9,89.8,2.9,332.8,4.2,1119,10,< 3.0,0,175.8,7.6,147.1,7.8,207.3,6.5,212,7.2,1.3,1.3,< 0.5,0,< 0.5,0,337.5,6.2,1306,10,25.1,5.6,< 1.0,0,< 2.0,0,< 2.0,0,< 4.0,0,< 4.0,0,< 5.1,0,< 4.0,0,< 4.0,0,< 2.0,0,< 2.0,0,< 2.0,0,0,0,< 1.0,0,< 1.0,0,< 1.0,0,< 1.0,0
449,Method 201,NO,169700,400,< 20,0,2034,26,40150,40,420.5,3.8,83800,60,18200,20,,,110200,200,4354,46,70,10,98.2,4.9,18.2,4.3,1484,10,429,6.2,6803,34,< 3.0,0,1498,15,334.9,9.2,333.6,7.6,195.7,7.5,< 0.5,0,< 0.5,0,< 0.5,0,358.8,6.4,1320,10,37.1,5.6,< 1.0,0,4264,100,< 2.0,0,< 4.0,0,< 4.0,0,< 5.1,0,< 4.0,0,< 4.0,0,< 2.0,0,< 2.0,0,< 2.0,0,0,0,< 1.0,0,< 1.0,0,< 1.0,0,< 1.0,0
567,Method 201,NO,168400,600,9460,200,1894,52,20560,40,1474,10,318800,200,979.9,4.9,,,8216,46,75840,120,0,0,693,11,30.7,6.8,2488,14,1795,11,12450,50,< 3.0,0,2250,18,160.6,8.2,130.3,6,202.1,7.2,5.5,4.6,< 0.5,0,0.7,0.7,62.9,4.5,18.6,4.4,536.1,7.7,< 1.0,0,4940,110,< 2.0,0,< 4.0,0,< 4.0,0,< 5.1,0,< 4.0,0,< 4.0,0,< 2.0,0,< 2.0,0,< 2.0,0,0,0,< 1.0,0,< 1.0,0,1.2,1.2,< 1.0,0
568,Method 201,NO,169300,600,3230,190,1455,51,11370,30,1414,10,330400,200,982.3,5.1,,,8977,48,69400,110,16,16,623,11,39.1,6.5,117.4,4.2,1147,8,2223,17,< 3.0,0,261.1,8.3,149,7.9,120.1,5.9,216.8,7.2,< 0.5,0,< 0.5,0,< 0.5,0,66.1,4.5,9.3,4.5,569.3,7.8,< 1.0,0,< 2.0,0,< 2.0,0,< 4.0,0,< 4.0,0,< 5.1,0,< 4.0,0,< 4.0,0,< 2.0,0,< 2.0,0,< 2.0,0,0,0,< 1.0,0,< 1.0,0,6.9,6.9,< 1.0,0
568_Repeat,Method 201,NO,169400,600,3200,190,1462,51,11340,30,1406,10,329400,200,981.7,5.1,,,8970,48,69400,110,5,5,633,11,37,6.6,115.1,4.2,1147,8,2302,17,< 3.0,0,272.6,8.3,137.8,7.8,126.2,5.9,218,7.2,< 0.5,0,< 0.5,0,< 0.5,0,72,4.6,23.5,4.5,592,7.8,< 1.0,0,< 2.0,0,< 2.0,0,< 4.0,0,< 4.0,0,< 5.1,0,< 4.0,0,< 4.0,0,< 2.0,0,< 2.0,0,< 2.0,0,0,0,< 1.0,0,< 1.0,0,5.3,5.3,< 1.0,0
577,Method 5,NO,67970,330,18750,140,3409,43,268300,200,1226,6,116400,100,462.7,2.8,,,3738,32,62870,110,0,0,477.4,9.5,41,5.7,63.1,3.4,1154,8,1984,16,< 3.0,0,256.5,8,130.4,7.5,118.8,5.7,212.1,7,< 0.5,0,< 0.5,0,3.5,3.5,26.9,3.9,6.6,4,416.6,6.9,< 1.0,0,< 2.0,0,< 2.0,0,< 4.0,0,< 4.0,0,< 5.1,0,< 4.0,0,< 4.0,0,< 2.0,0,< 2.0,0,< 2.0,0,0,0,< 1.0,0,< 1.0,0,< 1.0,0,< 1.0,0
578,Method 5,NO,64440,320,14770,130,3020,42,258600,200,1215,6,115400,100,685.1,3.2,,,3869,32,48160,90,0,0,413.4,8.8,30.8,5.5,54.6,3.4,723.1,6.3,1682,14,< 3.0,0,265.8,7.8,141.6,7.3,99,5.4,206.8,6.9,< 0.5,0,< 0.5,0,< 0.5,0,33.8,3.9,0.7,0.7,311.4,6.4,< 1.0,0,< 2.0,0,< 2.0,0,< 4.0,0,< 4.0,0,< 5.1,0,< 4.0,0,< 4.0,0,< 2.0,0,< 2.0,0,< 2.0,0,0,0,< 1.0,0,< 1.0,0,< 1.0,0,< 1.0,0
5899,Method 5,NO,6570,450,430,220,9423,81,9586,35,10960,20,291000,200,67060,50,,,711500,500,44250,130,354,35,603,12,73,7.5,292.9,5.8,2659,12,8651,41,< 3.0,0,225.4,8.4,1327,14,18510,40,252.9,8.8,< 0.5,0,46.8,7.9,< 0.5,0,1117,10,3960,16,718.4,8.3,< 1.0,0,< 2.0,0,< 2.0,0,< 4.0,0,< 4.0,0,< 5.1,0,< 4.0,0,< 4.0,0,< 2.0,0,< 2.0,0,39,1.2,0,0,< 1.0,0,< 1.0,0,847,15,< 1.0,0
5899_Repeat,Method 5,NO,7950,440,600,220,9521,81,9650,35,10940,20,290800,200,66970,50,,,712100,500,44450,130,324,35,571,12,69.3,7.4,292.1,5.8,2640,12,8608,41,< 3.0,0,238.6,8.5,1322,14,18450,40,247.8,8.8,< 0.5,0,71.6,7.8,< 0.5,0,1132,10,3935,16,701.4,8.3,< 1.0,0,< 2.0,0,< 2.0,0,< 4.0,0,< 4.0,0,< 5.1,0,< 4.0,0,< 4.0,0,< 2.0,0,< 2.0,0,59.3,1.8,0,0,< 1.0,0,< 1.0,0,787,15,< 1.0,0
5900,Method 5,NO,10210,430,2540,210,10690,80,19950,50,10940,20,263100,200,64050,50,,,599800,500,54300,140,343,38,578,11,65.5,7.2,298.9,5.7,2169,11,7995,39,< 3.0,0,224.9,8.4,1089,13,15420,40,264.1,8.5,< 0.5,0,32.9,6.9,< 0.5,0,925,9.2,2947,14,594.7,7.9,< 1.0,0,< 2.0,0,< 2.0,0,< 4.0,0,< 4.0,0,< 5.1,0,< 4.0,0,< 4.0,0,< 2.0,0,< 2.0,0,19.6,0.6,0,0,< 1.0,0,< 1.0,0,620,13,< 1.0,0
5901,Method 5,NO,10260,440,2010,220,10170,80,11580,40,11290,20,271700,200,66360,50,,,673500,500,46090,130,322,35,587,12,67.8,7.4,290.2,5.7,2541,12,8799,41,< 3.0,0,218.2,8.5,1267,14,18390,40,252.3,8.9,< 0.5,0,57,7.7,< 0.5,0,1133,10,3661,16,684.9,8.2,< 1.0,0,< 2.0,0,< 2.0,0,< 4.0,0,< 4.0,0,< 5.1,0,< 4.0,0,< 4.0,0,< 2.0,0,< 2.0,0,46.8,1.4,0,0,< 1.0,0,< 1.0,0,790,15,< 1.0,0
7320,Method 201,NO,174700,500,3470,110,8720,48,129100,100,452.7,5,139300,100,6609,9,,,16100,60,109100,100,235,47,928,13,83.1,7.6,190.8,5,105.4,3.3,3634,23,< 3.0,0,205.8,7.5,187.1,7.7,4574,22,238.9,7.3,< 0.5,0,22.4,3.5,< 0.5,0,126.7,4.7,135,5,214.6,6.1,< 1.0,0,< 2.0,0,< 2.0,0,< 4.0,0,< 4.0,0,< 5.1,0,< 4.0,0,< 4.0,0,< 2.0,0,< 2.0,0,79.3,2.8,0,0,< 1.0,0,< 1.0,0,19,8.2,< 1.0,0
7323,Method 201,NO,176500,500,< 20,0,4928,51,71390,80,572.8,6.8,233300,200,10870,10,,,15310,60,90620,130,291,43,807,12,69.8,7.3,176.7,4.8,102.4,3.3,3228,21,< 3.0,0,198.9,7.4,211,7.7,3388,19,197.3,7.6,< 0.5,0,< 0.5,0,< 0.5,0,822.6,8.4,146.3,6.1,215.5,6,< 1.0,0,< 2.0,0,< 2.0,0,< 4.0,0,< 4.0,0,< 5.1,0,< 4.0,0,< 4.0,0,< 2.0,0,< 2.0,0,52,1.8,0,0,< 1.0,0,< 1.0,0,17.2,8.1,< 1.0,0
7326,Method 201,NO,56390,220,26440,110,24600,60,320900,200,242.1,2.6,< 2.0,0,1202,3,,,15610,60,130700,200,161,50,1019,14,74.9,7.9,197.4,5.2,88.3,3.2,3317,22,< 3.0,0,185.5,7.4,171.6,7.5,3402,19,238,7.2,< 0.5,0,14.4,3.4,< 0.5,0,396.9,6.3,76,5.1,203.9,6,< 1.0,0,< 2.0,0,< 2.0,0,< 4.0,0,< 4.0,0,< 5.1,0,< 4.0,0,< 4.0,0,< 2.0,0,< 2.0,0,94.1,3.4,0,0,< 1.0,0,< 1.0,0,22.3,7.8,< 1.0,0
87,Method 5,NO,203100,500,< 20,0,1375,28,10690,20,1035,6,145100,100,12030,10,,,49280,110,51930,100,0,0,129,14,65,7.4,527.7,6.7,623.2,6.4,1906,15,< 3.0,0,447.6,9.7,213.1,8.3,772,10,198.7,7.2,< 0.5,0,9.4,3.8,< 0.5,0,563,7.3,362.7,6.9,234.8,6.4,< 1.0,0,< 2.0,0,< 2.0,0,< 4.0,0,< 4.0,0,< 5.1,0,< 4.0,0,< 4.0,0,3100,2700,< 2.0,0,< 2.0,0,0,0,< 1.0,0,< 1.0,0,46,8.5,< 1.0,0
88,Method 5,NO,203300,500,< 20,0,1503,31,8131,20,1128,6,152400,100,18230,20,,,54960,120,65950,110,24,24,699,12,141.8,7.7,551.1,7.1,763.6,6.7,2119,16,< 3.0,0,559,11,250.4,8.6,1104,12,198.2,7.3,< 0.5,0,9.3,4.1,< 0.5,0,664.5,7.9,430.8,7.4,306.2,6.8,< 1.0,0,< 2.0,0,< 2.0,0,< 4.0,0,< 4.0,0,< 5.1,0,< 4.0,0,< 4.0,0,< 2.0,0,< 2.0,0,151.9,4.5,0,0,< 1.0,0,< 1.0,0,70.8,9,< 1.0,0
88_Repeat,Method 5,NO,203000,500,< 20,0,1352,30,8175,20,1124,6,152700,100,18230,20,,,55110,120,65930,110,30,30,698,12,127.1,7.7,542.5,7.2,743.8,6.8,2145,17,< 3.0,0,558,10,236.6,8.7,1102,12,211.6,7.4,< 0.5,0,10.8,4.1,< 0.5,0,675.1,7.9,429.2,7.4,303.3,6.8,< 1.0,0,< 2.0,0,< 2.0,0,< 4.0,0,< 4.0,0,< 5.1,0,< 4.0,0,< 4.0,0,< 2.0,0,< 2.0,0,153.7,4.6,0,0,< 1.0,0,< 1.0,0,69.7,9.1,< 1.0,0
571,Method 201,BLK,3270,120,3186,67,5180,47,532500,300,323.8,3.4,< 2.0,0,208.2,1.5,,,639,13,6467,33,48,12,72.5,4.1,11,3.5,73,3,30.8,2.4,1131,10,< 3.0,0,200.5,7.4,147.8,7.4,87.3,5.3,212.6,7,< 0.5,0,< 0.5,0,< 0.5,0,< 0.5,0,< 0.5,0,29.7,5.1,< 1.0,0,< 2.0,0,< 2.0,0,< 4.0,0,< 4.0,0,< 5.1,0,< 4.0,0,< 4.0,0,< 2.0,0,< 2.0,0,< 2.0,0,0,0,< 1.0,0,< 1.0,0,< 1.0,0,< 1.0,0
572,Method 201,BLK,3010,130,2933,70,5295,49,567000,400,311.9,3.4,< 2.0,0,151.2,1.3,,,687,14,6896,34,43,12,71.1,4.1,15.6,3.7,76.3,3.1,35.6,2.6,1149,10,< 3.0,0,201.9,7.4,135.1,7.4,73.3,5.3,216.8,7.1,< 0.5,0,< 0.5,0,< 0.5,0,< 0.5,0,3.5,3.5,21,5.1,< 1.0,0,< 2.0,0,< 2.0,0,< 4.0,0,< 4.0,0,< 5.1,0,< 4.0,0,< 4.0,0,< 2.0,0,< 2.0,0,< 2.0,0,0,0,< 1.0,0,< 1.0,0,< 1.0,0,< 1.0,0
573,Method 201,BLK,2940,130,3126,71,5351,49,565400,400,248.9,3.2,< 2.0,0,99.7,1,,,728,14,6951,34,38,12,82.7,4.3,11,3.7,74.5,3,40.4,2.5,1089,10,< 3.0,0,174.3,7.3,131.8,7.5,76.3,5.4,206.5,7,< 0.5,0,< 0.5,0,< 0.5,0,< 0.5,0,4.4,4,20.5,5.1,< 1.0,0,< 2.0,0,< 2.0,0,< 4.0,0,< 4.0,0,< 5.1,0,< 4.0,0,< 4.0,0,< 2.0,0,< 2.0,0,< 2.0,0,0,0,< 1.0,0,< 1.0,0,< 1.0,0,< 1.0,0
581,Method 5,BLK,< 101,0,1000,69,4413,51,601500,400,49.7,2.7,< 2.0,0,48.6,0.9,,,150.2,7,289.6,7.2,28.5,3.7,51.1,3.7,15.4,3.4,40.9,2.6,34.6,2.4,914.2,8.3,< 3.0,0,233.3,7.5,135.3,7.1,61.7,5,219.1,6.8,< 0.5,0,< 0.5,0,< 0.5,0,< 0.5,0,< 0.5,0,5.5,4.7,< 1.0,0,< 2.0,0,< 2.0,0,< 4.0,0,< 4.0,0,< 5.1,0,< 4.0,0,< 4.0,0,< 2.0,0,< 2.0,0,< 2.0,0,0,0,< 1.0,0,< 1.0,0,< 1.0,0,< 1.0,0
582,Method 5,BLK,< 101,0,1007,69,4543,51,607400,400,53.1,2.8,< 2.0,0,56.1,1,,,143.4,7,361.5,8.1,30.3,3.8,51.2,3.7,13.5,3.4,40.1,2.5,36.5,2.3,907,8.3,< 3.0,0,228.7,7.8,133.7,7.4,56.9,5.1,209.7,6.9,< 0.5,0,< 0.5,0,4.6,4,3.7,3.6,< 0.5,0,5,4.8,< 1.0,0,< 2.0,0,< 2.0,0,< 4.0,0,< 4.0,0,< 5.1,0,< 4.0,0,< 4.0,0,< 2.0,0,< 2.0,0,< 2.0,0,0,0,< 1.0,0,< 1.0,0,< 1.0,0,< 1.0,0
583,Method 5,BLK,< 101,0,1206,64,4373,48,581100,400,63.4,2.6,< 2.0,0,58.1,0.9,,,140,6.9,322.9,7.5,30.3,3.7,49.6,3.6,9.3,3.4,41.6,2.6,31.3,2.4,917.7,8.4,< 3.0,0,221.2,7.6,127,7.3,59.4,5.1,206.7,6.8,< 0.5,0,< 0.5,0,< 0.5,0,< 0.5,0,< 0.5,0,< 0.5,0,< 1.0,0,< 2.0,0,< 2.0,0,< 4.0,0,< 4.0,0,< 5.1,0,< 4.0,0,< 4.0,0,< 2.0,0,< 2.0,0,< 2.0,0,0,0,< 1.0,0,< 1.0,0,< 1.0,0,< 1.0,0
574,NA,BLK,2870,130,2952,70,5295,49,566100,400,320.1,3.4,< 2.0,0,45.2,0.8,,,676,13,6680,34,32,12,68.9,4.1,12.1,3.6,75.3,3.1,40.1,2.5,1071,10,< 3.0,0,175,7.3,133.4,7.3,72.6,5.3,196.6,6.8,< 0.5,0,< 0.5,0,< 0.5,0,< 0.5,0,< 0.5,0,32.7,5,< 1.0,0,< 2.0,0,< 2.0,0,< 4.0,0,< 4.0,0,< 5.1,0,< 4.0,0,< 4.0,0,< 2.0,0,< 2.0,0,< 2.0,0,0,0,< 1.0,0,< 1.0,0,< 1.0,0,< 1.0,0
574-Repeat,NA,BLK,2830,130,2956,70,5245,49,560000,400,310.8,3.4,< 2.0,0,46.5,0.8,,,680,13,6632,34,36,12,75,4.1,15,3.6,72.8,3,38.4,2.5,1043,9,< 3.0,0,187.4,7.4,130.4,7.5,79.4,5.3,223.1,6.8,8.8,4.3,< 0.5,0,4.1,4.1,< 0.5,0,7.2,4,13.1,5.2,< 1.0,0,< 2.0,0,< 2.0,0,< 4.0,0,< 4.0,0,< 5.1,0,< 4.0,0,< 4.0,0,< 2.0,0,< 2.0,0,< 2.0,0,0,0,< 1.0,0,< 1.0,0,1.6,1.6,< 1.0,0
584,NA,BLK,< 101,0,873,67,4374,49,590000,400,56.5,2.6,< 2.0,0,38.4,0.8,,,159.1,7.1,301.2,7.3,31.4,3.7,46.7,3.6,14.4,3.4,38,2.5,30.4,2.3,876.7,8.1,< 3.0,0,223,7.5,128.7,7.2,56.8,5,216.6,6.8,< 0.5,-0.3,< 0.5,0,< 0.5,0,< 0.5,0,< 0.5,0,< 0.5,0,< 1.0,0,< 2.0,0,< 2.0,0,< 4.0,0,< 4.0,0,< 5.1,0,< 4.0,0,< 4.0,0,< 2.0,0,< 2.0,0,< 2.0,0,0,0,< 1.0,0,< 1.0,0,3.1,3.1,< 1.0,0
586,NA,BLK,37970,210,2536,49,42450,70,263900,200,167.1,2.1,< 2.0,0,548.2,2,,,67620,130,37930,90,118,32,5890,130,726,61,42,14,< 1.0,0,2610,20,< 3.0,0,279.3,9.9,101,11,209600,200,465,13,23.2,6.3,13.4,3.7,< 0.5,0,< 0.5,0,106.1,4.9,1287,10,< 1.0,0,< 2.0,0,< 2.0,0,< 4.0,0,< 4.0,0,< 5.1,0,< 4.0,0,< 4.0,0,564000,15000,< 2.0,0,1570,150,0,0,< 1.0,0,< 1.0,0,33.4,8.4,< 1.0,0
586_Repeat,NA,BLK,37090,210,2376,48,42440,70,263800,200,167.2,2.1,< 2.0,0,546,2,,,67590,130,37960,90,124,32,6110,130,659,60,53,14,< 1.0,0,2669,20,< 3.0,0,306,10,99,11,209100,200,448,13,23.6,6.2,11.5,3.6,< 0.5,0,0.7,0.7,102.7,4.9,1270,10,< 1.0,0,< 2.0,0,< 2.0,0,< 4.0,0,< 4.0,0,< 5.1,0,< 4.0,0,< 4.0,0,562000,15000,< 2.0,0,1480,150,0,0,< 1.0,0,< 1.0,0,29.1,8.3,< 1.0,0
587,NA,BLK,37660,220,2490,49,43060,70,267400,200,165,2.1,< 2.0,0,534.5,2,,,66610,130,37220,90,132,32,5910,130,664,60,53,14,< 1.0,0,2621,20,< 3.0,0,263.9,9.8,105,11,203500,200,441,13,13.7,6.2,8.9,3.7,< 0.5,0,< 0.5,0,100.8,4.9,1228,10,< 1.0,0,< 2.0,0,< 2.0,0,< 4.0,0,< 4.0,0,< 5.1,0,< 4.0,0,< 4.0,0,542000,15000,< 2.0,0,1530,150,0,0,< 1.0,0,< 1.0,0,31,8.3,< 1.0,0
588,NA,BLK,37570,220,2463,49,43390,70,270900,200,174.2,2.1,< 2.0,0,507.7,2,,,69770,140,38940,90,146,32,6140,130,706,62,58,15,< 1.0,0,2786,21,< 3.0,0,294,10,91,11,218600,200,462,13,18.7,6.4,13.5,3.6,< 0.5,0,2.9,2.9,125.4,4.9,1344,11,< 1.0,0,< 2.0,0,< 2.0,0,< 4.0,0,< 4.0,0,< 5.1,0,< 4.0,0,< 4.0,0,571000,15000,< 2.0,0,1680,160,0,0,< 1.0,0,< 1.0,0,24.1,8.4,< 1.0,0
SRM 2783 1657,NA,NA,1063,42,4480,35,8714,24,11860,20,194.7,1.5,< 2.0,0,333,1.3,,,805,14,1709,17,3.2,3.2,228.3,5.5,4,3.1,26.8,1.8,46.6,1.9,3588,22,< 3.0,0,191.8,6.5,155.7,6.8,251.5,6.4,176.5,6.4,< 0.5,0,< 0.5,0,< 0.5,0,30.3,3.4,5.4,3.3,9.7,4.1,< 1.0,0,< 2.0,0,< 2.0,0,< 4.0,0,< 4.0,0,< 5.1,0,< 4.0,0,< 4.0,0,< 2.0,0,< 2.0,0,< 2.0,0,0,0,< 1.0,0,< 1.0,0,18.6,6.3,< 1.0,0
SRM 2783 1657,NA,NA,975,41,4479,35,8458,24,11710,20,191.9,1.4,< 2.0,0,324.3,1.3,,,782,13,1710,17,15.4,5.8,220.7,5.5,4.3,3,26.2,1.7,44,1.8,3676,23,5.3,5.3,189,6.5,165,6.7,263.6,6.3,192.2,6.4,< 0.5,0,< 0.5,0,< 0.5,0,31.7,3.4,< 0.5,0,5,4.1,< 1.0,0,< 2.0,0,< 2.0,0,< 4.0,0,< 4.0,0,< 5.1,0,< 4.0,0,< 4.0,0,< 2.0,0,< 2.0,0,< 2.0,0,0,0,< 1.0,0,< 1.0,0,8.1,6.1,< 1.0,0
SRM 2783 1657,NA,NA,1028,41,4507,35,8788,24,12120,20,200.5,1.5,< 2.0,0,337,1.3,,,809,14,1790,18,15.3,6,236.9,5.6,3.3,3.1,25,1.8,45.2,1.9,3795,23,< 3.0,0,181.1,6.6,148.1,6.7,276.8,6.4,192.6,6.3,< 0.5,0,< 0.5,0,< 0.5,0,37.1,3.4,3.8,3.3,< 0.5,0,< 1.0,0,< 2.0,0,< 2.0,0,< 4.0,0,< 4.0,0,< 5.1,0,< 4.0,0,< 4.0,0,< 2.0,0,< 2.0,0,< 2.0,0,0,0,< 1.0,0,< 1.0,0,26.4,6.2,< 1.0,0
SRM 2783 BLANK,NA,NA,143,32,79.6,9.9,308.8,4.7,52,1.3,< 3.0,0,< 2.0,0,134,0.8,,,41.8,3.8,36,2.8,13.1,2,3.6,2,< 1.0,0,2.8,1.3,10.5,1.3,617.4,5.9,< 3.0,0,181.1,6.3,115.7,6.3,48.7,4.4,205.3,6.3,< 0.5,0,< 0.5,0,< 0.5,-0.3,27.5,3.2,< 0.5,0,< 0.5,0,< 1.0,0,< 2.0,0,< 2.0,0,< 4.0,0,< 4.0,0,< 5.1,0,< 4.0,0,< 4.0,0,< 2.0,0,< 2.0,0,< 2.0,0,0,0,< 1.0,0,< 1.0,0,< 1.0,0,< 1.0,0
&#13;
&#13;
&#13;

我正在尝试使用数据框中的数据计算&#39; df_new2&#39;。但是,我需要根据列#34;方法&#34;中的字符串数据为流应用不同的值。这是在相同的数据框中&#39; df_new2&#39;。列中的每一行&#39;方法&#39;可能是&#39;方法A&#39;,方法B&#39;或者&#39;方法C&#39;。每种方法的公式都可以变化。

我有以下内容但是我遇到了语法错误。

calculated = df_new2[my_elements].apply(lambda x: x*F_area/(flow_5*1e3) 
                                    if df_new2['Method'] == 'Method 5')

我在这里做错了什么?

1 个答案:

答案 0 :(得分:1)

你可以在lambda函数中使用if语句,但每次都必须返回一些东西,所以你可以这样做:

calculated = df_new2[my_elements].apply(lambda x: x*F_area/(flow_5*1e3) 
                                if df_new2['Method'] == 'Method 5' else np.nan).dropna()

编辑: 你应该在df_new2上使用apply:

calculated = df_new2.apply(lambda x: x.my_elements*F_area/(flow_5*1e3) 
                                if x.Method == 'Method 5' else np.nan, axis=1).dropna()