Find a way to implement & to store the input as a data structure so that you can store the readings for each day and easily find the maximum.
The first element in the input is the desired date (e.g., ’2022-09-08;’). What follows is a list of triplets, separated with a semicolon ’;’. One triplet represents one reading instance with the structure ’date,id,covid level;’. Find the maximum covid level found in the sewage system on the desired date and output the sensor ID and the covid level.
The program takes as input: (string)’yyyy-mm-dd’, (int)sensor id, (int)covid level. The expected output is sensor id,covid level.
Input: 2022−09−08;2022−09−08,23,371;2022−09−08,2,3171;2022−09−08,12,43;2021− 03−21,4,129
Output: 2,3171. So on 2022-09-08, sensor 2 has the most covid with 3171.
This is my code so far:
import sys
def add_value(dict_obj, key, value):
if key not in dict_obj:
dict_obj[key] = list()
dict_obj[key].append(value)
# get maximum for specific day
def get_max(dic, date):
for keys in dic:
if dic.keys() == date:
maximum_val = max(data[requested_date], key=lambda key: data[requested_date][key])
return maximum_val
if __name__ == "__main__":
input = input()
input = input.split(";")
requested_date = input.pop(0)
data = dict()
for d in input:
date, id, value = d.split(',', 2)
date = date.strip()
if not date in data.keys():
data[date] = dict()
data[date][int(id)] = int(value)
print(get_max(), data[requested_date][maximum_val], sep=', ')
I'm quite lost as to what I should put in the function to pull the data.
With input:
2022-09-08;2023-03-10,8040,592106;2023-01-22,2841,706585;2020-08-02,2815,322161;2023-08-04,7554,220090;2019-12-25,968,630741;2022-06-16,2875,253359;2022-05-23,6552,843864;2021-03-20,2147,821497;2022-08-09,4922,791196;2022-02-24,2838,41502;2019-10-12,9772,415292;2021-10-18,6005,601637;2021-01-20,3192,393392;2022-01-13,4649,620701;2022-09-21,6054,395666;2022-01-28,2609,166292;2020-07-01,5035,554898;2020-06-22,753,190624;2022-04-08,2971,791105;2022-10-20,5017,865587;2022-08-31,4485,182256;2022-09-17,4971,277084;2019-10-13,8915,608797;2020-04-06,1649,106141;2020-01-10,1857,48025;2022-07-13,7666,102177;2021-05-13,8847,855572;2019-10-16,8552,752346;2023-05-05,8652,348809;2020-07-14,358,703220;2022-11-27,7410,632703;2020-07-26,8009,855042;2023-05-01,5221,838684;2020-12-24,3200,337795;2022-08-14,7584,475355;2022-01-16,5278,35680;2023-08-09,7373,514720;2020-05-24,8201,904354;2021-05-15,2918,998517;2022-10-04,8659,430030;2023-01-22,4527,935;2022-05-21,3854,184112;2023-09-01,2091,137523;2022-02-23,2102,540617;2022-12-22,2066,511770;2021-12-15,3369,453164;2023-09-06,846,411479;2021-06-20,5132,630096;2021-07-26,3744,42834;2021-11-20,3887,42147;2021-02-23,539,263204;2020-07-24,698,836430;2020-08-18,7039,620019;2021-02-11,3713,807118;2022-12-26,667,414186;2022-05-29,1328,718651;2022-07-16,74,728713;2023-08-12,3732,761394;2021-11-12,4466,546809;2021-09-23,8737,679273;2023-08-07,3908,468407;2023-08-30,575,345297;2020-12-11,3090,193686;2023-03-27,6912,720916;2020-05-21,5198,484872;2020-02-06,2924,611742;2020-05-03,9545,735838;2023-08-21,138,147811;2020-06-14,2067,811756;2023-07-29,1660,291669;2021-08-19,6606,414275;2023-05-26,3333,252892;2022-02-14,826,997970;2020-06-05,3126,801525;2023-06-27,2608,308126;2022-01-17,5943,465622;2019-09-20,1401,634004;2020-10-24,7494,702397;2021-05-20,5319,806137;2023-01-14,3424,728719;2020-05-31,5921,21204;2019-10-24,6163,836506;2020-04-30,4101,495821;2021-05-26,9953,817246;2021-02-17,881,97476;2020-06-28,1024,775386;2020-08-02,9247,363244;2019-10-13,4180,233190;2020-09-03,9621,908041;2022-09-08,1986,16473;2022-03-21,2340,613348;2020-07-18,4856,709049;2023-01-23,7073,225369;2020-06-21,5706,863887;2022-05-11,250,347812;2020-08-24,2012,26302;2020-02-06,6957,993108;2022-07-15,4295,915835;2021-12-04,1810,543171;2021-02-17,2198,287942;2019-11-24,5006,258783;2021-03-05,1006,357835;2020-12-30,5165,939873;2022-01-19,7722,577380;2023-02-25,2150,28665;2021-10-10,887,765593;2022-05-05,9907,805191;2021-05-26,653,209279;2022-11-09,2612,800877;2020-06-30,4738,731829;2022-06-19,158,367429;2021-03-15,308,281264;2021-07-27,1469,642423;2022-11-28,4119,769739;2022-10-05,9382,676766;2020-01-13,676,2563;2021-02-01,6931,205262;2020-11-26,9236,240135;2023-04-10,569,549611;2023-05-23,5761,528313;2020-01-11,6561,128432;2020-06-01,8861,859638;2021-05-28,4590,888165;2021-09-24,7657,276401;2022-11-04,7845,941061;2021-01-19,6726,975456;2020-12-30,3282,349561;2022-10-30,2539,305830;2020-11-07,3195,386196;2023-04-20,9759,653065;2023-08-18,9845,848513;2023-07-23,3754,841520;2022-09-19,1920,772673;2020-08-31,7421,280909;2022-10-28,7502,582914;2023-07-23,9380,118339;2021-11-11,3446,486012;2020-12-04,6022,100457;2023-02-25,8198,263559;2023-02-18,233,802162;2020-04-14,6931,833891;2021-08-16,8611,103148;2021-03-17,5705,600363;2022-12-17,8493,454657;2022-04-27,1720,93919;2020-11-16,960,299754;2022-08-28,7263,407345;2019-10-14,5138,330640;2022-05-17,3275,212511;2020-08-12,9033,349621;2023-02-13,2480,199101;2022-04-28,1667,947734;2023-01-02,3285,211978;2021-01-23,926,925204;2019-09-27,9555,964549;2021-12-06,7324,840905;2023-04-07,4647,598810;2021-09-05,852,438391;2022-06-10,6315,811506;2022-08-08,7181,261061;2022-04-03,2596,296982;2020-09-29,362,115360;2021-08-28,1435,557469;2020-08-24,6315,691253;2022-04-27,5311,936464;2021-09-22,4296,932562;2021-05-15,4420,174489;2020-08-25,4618,511909;2019-11-01,1215,108098;2022-05-28,4087,272540;2019-12-14,4501,327421;2022-12-18,847,575943;2020-08-27,6116,386354;2022-05-18,3372,585920;2022-12-26,5349,292392;2020-06-06,9565,267087;2020-04-28,4914,46862;2020-10-06,1507,444726;2022-07-31,3578,888305;2021-02-26,1551,365790;2022-09-01,4138,954927;2023-04-30,9245,992256;2021-05-22,1593,525769;2022-04-13,1973,334781;2020-04-24,5148,638283;2021-12-19,4488,753088;2020-04-11,8789,596393;2020-10-27,7118,739578;2021-01-01,622,516455;2020-04-10,7511,978217;2020-01-23,5722,507367;2020-12-16,5708,59281;2020-05-27,6968,931341;2020-08-29,3184,856863;2020-04-18,1406,732242;2021-01-29,5955,512835;2022-12-08,9817,189756;2023-04-08,2483,392795;2022-12-05,1973,906850;2021-10-22,6414,528343;2021-12-18,4929,729590;2022-06-05,9881,693635;2022-10-24,337,382497;2022-02-25,2417,684073;2020-09-01,4805,142722;2023-02-16,4277,364287;2020-11-21,4258,682992;2019-11-04,1428,305544;2019-10-06,7482,890571;2023-03-02,7026,245790;2022-12-05,78,732890;2021-02-23,6744,600204;2020-06-09,8699,256933;2023-02-20,4215,91666;2022-11-03,3777,513626;2022-01-30,7735,52520;2021-12-02,9671,639050;2022-10-13,2325,115528;2022-02-22,641,162470;2021-06-29,9161,927587;2020-04-10,1339,309029;2021-03-06,6602,278628;2023-02-10,9400,117228;2020-10-27,9819,930680;2022-09-09,8336,130047;2022-01-30,4059,451140;2020-07-31,3440,657244;2020-10-31,815,204045;2023-08-23,528,449894;2020-11-20,4443,687309;2020-09-03,8549,264250;2021-12-04,6665,357733;2023-06-19,1387,857095;2023-08-23,8815,786659;2020-12-12,1484,213032;2020-03-22,8231,72738;2019-11-07,8572,794116;2022-08-28,8994,914087;2023-04-04,5922,495407;2021-07-15,8063,986283;2023-01-17,2733,648225;2021-02-20,8782,799587;2023-06-26,3046,85127;2020-07-20,2492,5549;2021-08-23,4194,725680;2022-09-24,5982,389574;2023-08-04,2863,417631;2021-06-21,3089,87329;2020-02-13,5635,880972;2021-01-23,623,41881;2022-01-22,6916,834842;2019-12-02,9903,812898;2019-11-22,1803,49279;2021-07-22,4235,295962;2021-08-27,9240,805760;2023-06-02,8164,516216;2021-08-22,144,772791;2020-05-02,2974,2242;2022-11-09,3148,395480;2021-01-04,9332,992888;2020-11-27,2394,432966;2023-02-04,258,746348;2022-08-02,1719,855526;2020-03-06,4686,798229;2022-11-21,4590,809144;2022-05-01,6888,251316;2020-11-20,9814,331380;2020-07-25,7666,24919;2021-06-28,5898,136897;2021-07-06,261,71551;2020-05-30,2161,823575;2021-02-04,2591,724688;2021-09-07,9138,126076;2021-04-11,4024,649254;2019-11-24,9750,197439;2020-08-20,710,193757;2022-08-24,6395,80011;2020-03-06,6898,661236;2019-12-23,9123,147752;2021-10-13,6864,278424;2021-04-19,4233,876696;2020-06-21,1341,644165;2021-03-23,7159,344225;2022-03-28,9154,728595;2021-01-08,722,101194;2020-09-25,3065,830708;2021-04-27,5687,245604;2020-10-31,1361,35623;2022-01-07,2975,714341;2020-01-18,6868,177828;2023-01-18,9971,735758;2022-09-07,6752,128977;2022-06-15,4183,973539;2019-10-03,7693,874271;2020-04-29,9800,498384;2023-03-02,2506,381520;2022-07-03,9022,335631;2022-10-28,8087,863478;2021-12-11,2029,971046;2019-12-11,1017,593196;2023-01-28,7834,905252;2021-12-21,3016,378606;2022-08-22,7953,906605;2022-09-16,9928,254478;2022-03-08,6406,905950;2020-05-03,9829,919740;2023-07-03,739,346903;2020-08-17,1527,379515;2023-01-09,1943,578346;2020-04-28,1167,380140;2022-07-09,6810,742441;2023-08-07,9470,845663;2020-06-21,7305,425547;2022-12-09,1982,702402;2022-10-11,6729,433239;2022-05-14,7878,696347;2023-03-18,6171,537929;2022-02-02,460,297527;2020-06-29,6220,481050;2019-12-05,3292,496380;2019-12-09,2322,835327;2022-06-14,8604,941001;2021-08-20,588,588880;2022-05-09,173,872616;2020-09-28,7075,117085;2023-01-27,5025,666654;2022-04-11,2854,927724;2023-05-21,2624,748632;2022-01-18,8949,542980;2021-05-22,8897,456640;2023-03-11,437,387983;2022-04-24,8638,324652;2020-10-19,325,20728;2020-01-31,6890,781188;2021-04-13,8301,50863;2022-01-31,2283,854849;2023-02-24,5360,194832;2020-10-04,982,726778;2021-09-16,6998,531060;2023-06-28,6722,54173;2022-06-12,4349,495195;2022-09-12,6819,230428;2020-12-04,6872,415200;2021-07-07,7823,43858;2020-05-25,823,996754;2020-10-12,2838,249178;2022-05-05,6447,241061;2020-03-27,100,42100;2022-04-20,3169,654637;2021-07-22,3142,25869;2022-04-02,2881,324263;2022-08-03,5251,300897;2022-09-12,3914,709642;2022-09-26,3194,6155;2019-12-18,7975,554870;2022-07-07,5565,124866;2022-10-06,277,913726;2021-06-11,7802,303802;2023-05-01,5359,891773;2023-01-12,7493,236687;2022-05-16,975,905620;2022-05-29,2436,117716;2020-05-27,2648,457577;2019-09-18,4130,769212;2020-10-10,4831,312021;2021-12-21,5852,350620;2022-04-01,4388,328866;2023-06-05,6926,531077;2023-01-17,2651,279354;2020-01-21,9224,82488;2021-02-17,957,702407;2020-09-06,4456,45760;2023-08-16,3596,507677;2022-10-03,3757,660887;2021-08-23,1999,738957;2022-01-01,1107,402243;2022-05-13,4095,614285;2022-02-18,6147,215722;2023-05-01,4480,468676;2022-02-12,4285,484849;2020-06-30,3613,462741;2021-03-18,9701,921262;2022-01-06,2350,881569;2021-10-12,3589,274860;2020-09-01,1546,401228;2021-04-09,2325,700508;2020-05-11,3360,231688;2022-12-08,4898,958821;2020-07-03,7090,342270;2021-08-23,1115,603985;2023-01-13,8244,989400;2020-11-30,4581,544385;2022-09-07,7684,389022;2021-06-07,8651,962350;2023-06-13,5899,389082;2022-04-10,7331,515455;2019-12-01,7156,578918;2022-10-09,1603,221238;2020-07-07,4449,489418;2020-09-29,9180,127273;2020-10-12,1973,173181;2023-05-10,3627,366640;2023-01-12,5046,398825;2021-02-04,346,739451;2020-07-17,9010,732495;2019-10-28,3028,388158;2023-07-13,2498,279813;2020-06-09,7753,530685;2022-07-07,2836,184048;2019-11-07,7470,218856;2022-05-13,223,44186;2022-11-29,8811,216768;2020-06-30,9255,90369;2023-07-16,8711,908740;2021-01-02,8531,130348;2023-06-05,9076,124073;2020-10-02,5324,815152;2022-01-12,7342,3500;2021-05-30,9842,846463;2021-01-28,5148,27173;2020-09-12,7965,625891;2021-11-12,1237,548655;2022-07-24,9863,518096;2020-07-15,5181,636232;2020-07-07,2005,934334;2023-04-30,6538,82946;2021-02-16,522,388282;2022-02-28,2767,343745;2019-11-26,60,976033;2020-03-18,56,411220;2021-02-27,8376,412688;2021-05-14,4194,916719;2020-10-19,8904,242407;2021-02-23,3914,612879;2022-02-14,7529,253756;2021-08-10,8540,516456;2021-10-23,4576,756738;2023-04-04,9303,551134;2023-04-08,7228,635548;2021-10-14,9381,152481;2021-02-11,6383,267200;2023-01-02,3121,966086;2021-06-10,3017,627661;2020-07-19,6607,402414;2022-04-05,345,80175;2023-08-02,3340,176814;2023-02-18,8914,142489;2021-10-01,3933,333911;2022-07-14,6169,101929;2020-03-07,3254,642538;2021-08-01,7403,345884;2021-09-02,3133,500665;2023-02-26,4013,737;2022-11-06,1563,512256;2022-07-09,1942,20744;2022-07-20,5812,765744;2022-03-16,5723,670630;2021-06-06,8726,225657;2022-08-15,2132,670294;2021-06-30,8747,839544;2022-04-18,1027,134757;2022-01-15,9007,894961;2022-11-28,7961,630603;2020-12-25,9756,643571;2023-06-11,6762,257218;2023-08-29,3874,931716;2020-12-26,9140,446924;2021-02-17,9188,796234;2022-11-23,8360,603720;2022-12-19,850,837139;2021-04-29,4416,325660;2021-06-27,5607,525152;2019-12-10,5235,300531;2020-02-02,2923,19821;2019-12-26,6734,127862;2022-12-05,7184,794578;2019-12-19,5673,925451;2023-07-09,1220,756958;2021-10-18,105,373051;2020-06-20,6134,488483;2023-03-28,5013,650503;2022-07-30,6137,852226;2023-03-29,2131,82041;2022-07-27,1905,185337;2020-11-28,5895,858930;2020-07-06,2608,999257;2022-03-23,5573,645895;2019-11-11,4367,760039;2021-02-01,6630,949172;2021-07-03,3393,34584;2022-06-06,8316,962628;2022-07-11,3486,95153;2022-01-04,3680,683701;2020-12-29,3137,384475;2020-04-03,6717,939359;2022-08-22,8454,647233;2022-12-07,4565,967805;2021-12-28,1960,490511;2021-08-07,7497,988042;2020-04-09,823,51307;2022-03-17,9471,354558;2022-08-17,7072,564047;2021-10-21,6839,900517;2021-07-05,3820,985737;2022-01-19,2134,782103;2022-04-03,8324,553604;2021-06-01,1153,141167;2023-02-14,7436,342713;2022-11-20,3378,29393;2020-04-24,3025,935180;2021-01-02,7235,390726;2021-02-04,9961,429927;2019-10-28,8162,601807;2020-11-17,5226,350326;2022-04-01,3516,493556;2020-06-12,4790,890501;2020-03-02,3982,771960;2022-03-21,6365,592325;2023-06-08,6601,325775;2022-05-21,5626,656737;2023-05-22,3858,478481;2022-06-30,6770,372949;2020-10-08,2544,865485;2023-05-20,1979,810781;2022-10-09,4105,875933;2021-05-07,3686,590130;2022-06-29,2302,525073;2022-03-27,7374,451560;2020-11-21,8853,894710;2020-03-01,1080,850723;2020-09-05,65,245017;2023-04-04,390,398402;2021-03-12,7065,650484;2021-06-01,8970,195456;2023-07-10,694,336997;2021-11-11,8382,137230;2022-03-03,7138,662905;2022-04-14,2718,389561;2021-03-06,8956,432828;2021-01-12,4177,270869;2021-10-13,3449,554445;2022-11-22,710,575213;2020-04-07,5843,461398;2022-04-28,6310,530065;2021-06-16,575,411230;2019-09-16,6126,18594;2022-08-12,9515,559603;2021-11-13,8735,193743;2019-10-05,3046,409896;2021-04-16,4779,19861;2021-10-22,5770,794446;2022-02-11,685,601115;2021-08-30,3823,916273;2020-08-05,825,960008;2020-09-28,6199,709416;2022-01-18,8837,906545;2021-05-26,3600,627044;2021-09-01,293,205742;2020-10-19,7129,319084;2022-09-24,6656,914795;2020-12-31,1845,503012;2020-02-11,2530,423577;2020-06-04,8507,484860;2023-02-14,9401,535215;2022-01-02,7951,420019;2020-05-17,6931,310649;2022-07-05,5761,17570;2023-02-12,6830,249095;2019-11-29,1696,937777;2020-11-25,5519,369569;2022-12-23,3417,883131;2021-06-13,4599,315443;2022-10-04,8927,47457;2019-12-16,7028,590946;2021-11-10,9031,732007;2021-07-29,2691,94510;2022-10-10,5232,615804;2021-12-28,9119,93228;2022-10-31,6377,95494;2023-03-18,5049,85798;2021-07-07,8129,376983;2021-03-31,1356,271537;2022-08-10,2287,385891;2023-06-18,197,426583;2021-01-18,8152,782277;2020-10-01,6952,869434;2020-11-07,7720,928687;2020-05-20,8709,949105;2022-10-01,2843,377704;2020-08-11,7224,592862;2023-04-27,2141,71664;2021-01-21,1890,552004;2020-09-03,6632,406649;2023-02-27,3952,114611;2021-07-01,1417,171050;2022-10-02,5153,225581;2021-01-13,4091,382373;2023-07-22,4803,185115;2022-02-10,6974,127998;2020-07-03,3524,653128;2021-03-13,7743,572786;2021-08-24,1964,73100;2019-11-07,2204,825154;2023-07-16,2705,435706;2020-09-26,5351,806970;2023-01-14,7995,620523;2020-10-19,293,696214;2022-08-21,587,981578;2023-02-17,388,754019;2020-03-19,7115,168672;2021-07-30,462,435885;2019-10-04,2359,240770;2021-11-06,3390,640522;2023-04-05,9406,544747;2022-01-28,8824,872399;2023-07-13,9356,302628;2023-08-22,4567,636958;2022-12-15,8246,43189;2022-01-10,4591,931600;2020-12-01,8075,148641;2023-04-19,381,915597;2023-02-10,2469,905120;2023-01-13,7113,313740;2022-06-25,7219,510821;2021-12-06,6535,99478;2019-09-24,2346,491540;2021-05-06,5484,241967;2019-11-08,3977,619909;2022-05-21,9416,634596;2020-03-18,8298,37885;2020-11-22,489,976977;2023-07-13,3396,969828;2022-09-15,2582,605360;2021-10-30,3421,658971;2022-07-26,5918,392930;2022-12-15,3800,481662;2021-06-15,6362,545928;2022-06-15,4038,109207;2022-09-07,6047,240807;2023-06-18,9812,411230;2023-08-13,9174,462459;2022-07-04,6542,149476;2020-08-16,3434,173721;2020-05-21,2098,871496;2022-09-20,7109,541753;2019-12-05,4677,256991;2021-12-16,1934,547585;2023-02-06,3253,993159;2022-04-12,7520,725435;2019-10-10,4071,425697;2020-05-02,5263,818393;2023-07-25,2106,728635;2021-07-30,2765,288735;2023-06-20,4650,321453;2020-11-28,2627,892016;2019-12-10,48,600167;2020-04-21,4319,403830;2023-02-16,5526,699042;2023-05-24,4081,691410;2022-05-10,5573,436788;2022-04-22,9792,860515;2022-05-03,4755,447855;2020-09-27,5486,567673;2020-03-24,7451,971932;2021-11-24,1618,455917;2020-05-04,6702,435043;2021-02-02,4073,259857;2022-08-29,5025,230304;2022-12-15,6088,760286;2020-01-12,4283,133555;2022-03-16,4164,936181;2019-11-19,4788,138012;2020-12-05,9099,789017;2020-01-07,874,29452;2021-03-09,9159,276782;2019-10-21,4382,539172;2020-01-08,3479,35810;2022-06-16,7508,295320;2021-04-15,8998,162396;2022-06-17,3645,167535;2021-02-11,5073,424935;2021-07-22,4985,646168;2019-10-13,8739,680149;2021-10-22,3921,970770;2022-11-03,4358,896591;2020-09-24,1701,159284;2023-01-13,7757,205163;2020-09-01,1759,237758;2023-03-07,6358,259221;2022-03-16,4545,886823;2022-06-28,8125,122786;2021-07-25,822,185170;2022-09-04,8864,186102;2023-06-20,2613,601638;2020-08-12,8386,380770;2021-09-05,255,441406;2022-07-19,3321,689915;2021-12-17,4450,616822;2021-06-02,1658,263719;2022-06-20,6693,202237;2021-11-08,7152,997139;2022-05-28,3600,82842;2020-12-22,8451,164437;2020-09-11,6179,793843;2020-05-07,1960,645637;2023-07-28,1119,745008;2019-10-03,6955,124980;2022-04-26,2283,342494;2020-08-21,6814,887060;2019-10-21,7314,476630;2020-02-09,3731,186051;2023-07-01,6642,403489;2022-01-28,2461,841324;2023-01-27,6485,168924;2019-09-15,1496,645501;2021-09-06,4486,846433;2019-09-26,4677,812293;2021-04-14,8728,579186;2022-06-29,342,628983;2022-05-28,2747,277725;2020-05-11,425,992249;2020-09-16,4649,747733;2020-06-24,5711,814665;2022-11-25,4546,75203;2021-01-02,7457,211720;2021-03-08,7319,501467;2020-01-06,5356,197446;2022-07-17,602,303854;2021-05-02,8854,213316;2020-08-03,8280,379793;2020-11-08,523,222502;2020-09-12,5783,34958;2020-02-24,5021,544074;2023-05-09,6718,119060;2019-11-26,7864,30084;2021-05-23,9877,572661;2023-07-08,7526,756829;2022-01-30,5884,38627;2022-08-07,9457,807763;2023-07-21,7985,681252;2022-11-15,8364,962576;2023-03-15,6588,863458;2021-07-13,6171,22016;2023-07-02,9138,876924;2023-03-19,595,512084;2022-02-21,8084,154188;2020-01-31,75,687857;2021-04-18,4503,270387;2022-02-11,7773,652545;2022-09-28,1823,592834;2020-09-16,161,362479;2019-11-16,7530,127268;2021-10-17,9968,617172;2023-01-11,2811,277521;2023-02-10,9505,731900;2023-02-27,6610,364412;2022-04-28,4049,282045;2022-02-27,1757,252143;2020-01-30,290,693675;2020-05-06,3528,309842;2021-02-26,9269,415620;2021-03-27,1925,935930;2021-11-30,3731,241079;2021-03-01,4380,43910;2022-03-05,5713,891179;2020-05-04,9260,569374;2022-07-18,6108,614844;2021-05-12,4430,814610;2019-11-07,7466,265772;2020-02-12,642,940849;2020-03-17,2834,619806;2022-05-23,4315,215658;2020-10-13,6406,889727;2022-08-14,5357,726529;2023-07-25,7568,562511;2021-09-07,4015,881831;2020-06-24,4457,383260;2020-06-20,2181,243957;2021-11-28,256,273162;2023-02-03,1369,635171;2023-06-17,3918,209680;2023-09-01,1915,901746;2021-01-13,3353,569024;2021-06-25,9073,641676;2022-08-31,1262,224778;2021-11-16,9760,849765;2019-10-08,6620,283428;2020-06-30,2981,886951;2020-04-07,8972,634165;2023-07-21,1018,142293;2020-06-26,8854,546292;2023-05-08,4649,908254;2023-02-26,180,477588;2021-11-26,4843,680715;2023-02-23,8309,40484;2023-07-01,7250,715285;2020-02-18,7179,774280;2021-05-04,6158,15697;2021-08-26,8220,784539;2022-07-11,1102,797137;2021-06-04,7448,591986;2022-04-03,4228,813793;2021-08-13,8158,84258;2021-09-14,9126,135461;2019-12-18,7967,989686;2021-12-17,2596,834311;2023-06-14,1855,630257;2020-12-17,926,806497;2023-03-22,4758,565822;2021-12-15,2621,81567;2022-11-04,2993,545417;2021-11-25,8806,51476;2020-04-02,4591,459286;2022-02-15,9067,828768;2021-02-01,1048,317043;2021-04-25,7099,874243;2020-09-14,7696,448223;2023-06-05,8094,520706;2020-06-05,5186,646452;2021-02-26,7871,704400;2020-09-12,4187,553551;2022-05-26,8635,373442;2022-10-31,635,238670;2021-01-15,8496,503777;2023-04-16,5959,50804;2021-03-09,7788,700147;2021-02-11,4059,603288;2022-09-26,7899,452808;2021-12-03,6311,95183;2023-08-16,4427,990591;2019-09-25,4268,80513;2022-01-31,4724,632990;2020-04-13,796,147684;2023-02-05,1642,299655;2019-10-11,2110,189175;2022-08-03,8092,472639;2019-12-22,6133,446440;2019-09-08,3045,721344;2020-09-20,4147,117231;2019-09-29,1668,622510;2020-12-28,5637,10007;2021-07-13,3182,399970;2020-03-29,9411,456063;2022-04-04,8048,97426;2021-08-29,532,626018;2019-09-20,1806,270252;2021-08-05,6021,295034;2020-06-22,7428,521301;2021-08-28,934,553541;2023-03-20,3713,182006;2019-10-27,4161,377345;2019-12-26,4796,510504;2021-04-09,9027,117403;2023-03-20,5562,563547;2021-09-30,6364,78062;2019-09-16,7238,126997;2021-03-02,4614,426453;2019-09-16,9134,365154;2021-04-23,4823,78514;2022-01-13,9800,656121;2022-06-14,8479,627000;2020-09-26,5604,570632;2021-04-03,6674,847543;2021-01-22,3960,883490;2021-02-26,1941,114279;2022-02-24,9067,829848;2020-01-24,6008,546148;2020-08-04,8127,863708;2019-09-30,8774,572748;2019-11-05,4260,684272;2021-11-29,388,392052;2023-01-23,5817,529607;2022-11-12,9012,151201;2020-06-09,3027,444390;2019-10-08,1101,174604;2019-11-21,1667,632763;2020-05-01,1051,902922;2023-03-08,9612,997792;2019-09-18,2229,861071;2023-02-27,6523,220700;2020-04-10,3125,295321;2022-08-24,8148,522212;2021-11-14,9831,112849;2023-09-06,2346,823945;2023-01-13,1983,661858;2019-11-07,6178,701018;2021-07-21,5004,839506;2020-02-24,3306,985320;2021-01-29,7368,92678;2020-06-21,2789,750842;2023-05-08,4421,296919;2022-11-03,7100,390179;2020-12-05,8934,40635;2022-09-21,763,258498;2022-02-05,6922,738109;2023-07-31,8084,177083;2019-12-18,8778,833040;2020-08-06,8105,667165;2020-08-27,5830,449914;2020-03-25,2565,688671;2023-05-11,3959,365617;2023-06-29,3137,28865;2022-08-07,9146,488912;2022-09-03,3682,188151;2021-11-17,9628,533092;2022-01-27,3063,828888;2021-09-05,5454,420827;2020-06-04,6522,306201;2023-06-28,52,641110;2020-10-11,5207,605137;2023-02-19,1137,338702;2022-05-11,7395,504294;2022-01-03,3872,298063;2022-03-09,6378,255123;2023-02-19,5569,809673;2021-05-06,5429,319057;2022-03-11,1136,460245;2022-09-27,7544,248755;2020-12-22,208,593024;2021-06-18,2028,493573;2020-03-22,7364,116117;2021-11-18,500,161077;2023-05-14,8404,296773;2021-05-17,154,629617;2020-08-02,8582,237989;2023-01-07,281,783919;2020-02-23,7894,924826;2022-10-08,6083,138723;2022-06-07,2834,323067;2021-04-19,6213,328183;2022-07-25,1083,560333;2021-07-19,4922,847690;2021-03-17,9062,370846;2019-10-27,7245,993369;2023-06-18,8473,897991;2020-07-02,533,279596;2021-05-18,1172,683427;2021-09-18,8215,523387;2021-04-13,7118,381382;2021-03-01,1064,787494;2021-09-15,7815,579930;2023-06-14,1927,33559;2021-02-17,6561,431113;2020-03-29,607,916733;2021-11-09,176,20010;2023-06-19,3474,913591;2020-07-25,6402,593290;2022-05-03,8804,833741;2022-09-08,4854,719678;2023-04-08,4698,909568;2023-01-19,9792,387612;2022-10-25,3752,345816;2021-12-23,3080,724081;2021-09-17,3079,782893;2022-08-12,5212,5865;2022-02-22,4504,683829;2022-10-12,7922,271952;2021-02-03,2671,111037;2020-04-21,9592,488395;2023-03-18,4848,229100;2022-08-27,7854,272283;2020-05-31,6394,218375;2023-07-27,5980,138449;2022-07-05,549,6663;2020-09-22,2116,170817;2020-01-17,4752,485679;2019-11-19,6281,810999;2023-03-28,4571,793711;2022-08-24,7633,236025;2020-04-23,4711,714317;2020-07-24,7058,267436;2023-03-19,1711,57765;2021-02-28,3037,346907;2020-03-17,5892,611991;2023-01-22,8196,817093;2021-05-27,1411,305778;2020-10-03,1507,483178;2022-01-16,4950,692150;2021-03-21,3229,181391;2020-09-15,513,442958;2020-02-22,6035,751504;2023-08-14,2872,172027;2022-04-19,8758,365639;2022-05-22,4208,305433;2021-05-19,6517,877540;2020-01-13,4067,473629;2021-05-19,6411,279000;2021-04-18,2747,184777;2021-05-06,3519,407794;2021-12-01,6229,114694;2020-01-22,9192,656938;2020-06-08,81,357339;2021-09-04,9826,561718;2023-01-23,451,423942;2019-09-30,7535,142558;2022-06-16,9581,430905;2019-10-03,2223,345775;2022-12-30,5775,609712;2019-11-26,8230,917513;2022-08-16,5966,627596;2022-09-08,9558,184999
The output should be:
4854,719678
CodePudding user response:
Try:
s = """2022-09-08;2023-03-10,8040,592106;2023-01-22,2841,706585;2020-08-02,2815,322161;2023-08-04,7554,220090;2019-12-25,968,630741;2022-06-16,2875,253359;2022-05-23,6552,843864;2021-03-20,2147,821497;2022-08-09,4922,791196;2022-02-24,2838,41502;2019-10-12,9772,415292;2021-10-18,6005,601637;2021-01-20,3192,393392;2022-01-13,4649,620701;2022-09-21,6054,395666;2022-01-28,2609,166292;2020-07-01,5035,554898;2020-06-22,753,190624;2022-04-08,2971,791105;2022-10-20,5017,865587;2022-08-31,4485,182256;2022-09-17,4971,277084;2019-10-13,8915,608797;2020-04-06,1649,106141;2020-01-10,1857,48025;2022-07-13,7666,102177;2021-05-13,8847,855572;2019-10-16,8552,752346;2023-05-05,8652,348809;2020-07-14,358,703220;2022-11-27,7410,632703;2020-07-26,8009,855042;2023-05-01,5221,838684;2020-12-24,3200,337795;2022-08-14,7584,475355;2022-01-16,5278,35680;2023-08-09,7373,514720;2020-05-24,8201,904354;2021-05-15,2918,998517;2022-10-04,8659,430030;2023-01-22,4527,935;2022-05-21,3854,184112;2023-09-01,2091,137523;2022-02-23,2102,540617;2022-12-22,2066,511770;2021-12-15,3369,453164;2023-09-06,846,411479;2021-06-20,5132,630096;2021-07-26,3744,42834;2021-11-20,3887,42147;2021-02-23,539,263204;2020-07-24,698,836430;2020-08-18,7039,620019;2021-02-11,3713,807118;2022-12-26,667,414186;2022-05-29,1328,718651;2022-07-16,74,728713;2023-08-12,3732,761394;2021-11-12,4466,546809;2021-09-23,8737,679273;2023-08-07,3908,468407;2023-08-30,575,345297;2020-12-11,3090,193686;2023-03-27,6912,720916;2020-05-21,5198,484872;2020-02-06,2924,611742;2020-05-03,9545,735838;2023-08-21,138,147811;2020-06-14,2067,811756;2023-07-29,1660,291669;2021-08-19,6606,414275;2023-05-26,3333,252892;2022-02-14,826,997970;2020-06-05,3126,801525;2023-06-27,2608,308126;2022-01-17,5943,465622;2019-09-20,1401,634004;2020-10-24,7494,702397;2021-05-20,5319,806137;2023-01-14,3424,728719;2020-05-31,5921,21204;2019-10-24,6163,836506;2020-04-30,4101,495821;2021-05-26,9953,817246;2021-02-17,881,97476;2020-06-28,1024,775386;2020-08-02,9247,363244;2019-10-13,4180,233190;2020-09-03,9621,908041;2022-09-08,1986,16473;2022-03-21,2340,613348;2020-07-18,4856,709049;2023-01-23,7073,225369;2020-06-21,5706,863887;2022-05-11,250,347812;2020-08-24,2012,26302;2020-02-06,6957,993108;2022-07-15,4295,915835;2021-12-04,1810,543171;2021-02-17,2198,287942;2019-11-24,5006,258783;2021-03-05,1006,357835;2020-12-30,5165,939873;2022-01-19,7722,577380;2023-02-25,2150,28665;2021-10-10,887,765593;2022-05-05,9907,805191;2021-05-26,653,209279;2022-11-09,2612,800877;2020-06-30,4738,731829;2022-06-19,158,367429;2021-03-15,308,281264;2021-07-27,1469,642423;2022-11-28,4119,769739;2022-10-05,9382,676766;2020-01-13,676,2563;2021-02-01,6931,205262;2020-11-26,9236,240135;2023-04-10,569,549611;2023-05-23,5761,528313;2020-01-11,6561,128432;2020-06-01,8861,859638;2021-05-28,4590,888165;2021-09-24,7657,276401;2022-11-04,7845,941061;2021-01-19,6726,975456;2020-12-30,3282,349561;2022-10-30,2539,305830;2020-11-07,3195,386196;2023-04-20,9759,653065;2023-08-18,9845,848513;2023-07-23,3754,841520;2022-09-19,1920,772673;2020-08-31,7421,280909;2022-10-28,7502,582914;2023-07-23,9380,118339;2021-11-11,3446,486012;2020-12-04,6022,100457;2023-02-25,8198,263559;2023-02-18,233,802162;2020-04-14,6931,833891;2021-08-16,8611,103148;2021-03-17,5705,600363;2022-12-17,8493,454657;2022-04-27,1720,93919;2020-11-16,960,299754;2022-08-28,7263,407345;2019-10-14,5138,330640;2022-05-17,3275,212511;2020-08-12,9033,349621;2023-02-13,2480,199101;2022-04-28,1667,947734;2023-01-02,3285,211978;2021-01-23,926,925204;2019-09-27,9555,964549;2021-12-06,7324,840905;2023-04-07,4647,598810;2021-09-05,852,438391;2022-06-10,6315,811506;2022-08-08,7181,261061;2022-04-03,2596,296982;2020-09-29,362,115360;2021-08-28,1435,557469;2020-08-24,6315,691253;2022-04-27,5311,936464;2021-09-22,4296,932562;2021-05-15,4420,174489;2020-08-25,4618,511909;2019-11-01,1215,108098;2022-05-28,4087,272540;2019-12-14,4501,327421;2022-12-18,847,575943;2020-08-27,6116,386354;2022-05-18,3372,585920;2022-12-26,5349,292392;2020-06-06,9565,267087;2020-04-28,4914,46862;2020-10-06,1507,444726;2022-07-31,3578,888305;2021-02-26,1551,365790;2022-09-01,4138,954927;2023-04-30,9245,992256;2021-05-22,1593,525769;2022-04-13,1973,334781;2020-04-24,5148,638283;2021-12-19,4488,753088;2020-04-11,8789,596393;2020-10-27,7118,739578;2021-01-01,622,516455;2020-04-10,7511,978217;2020-01-23,5722,507367;2020-12-16,5708,59281;2020-05-27,6968,931341;2020-08-29,3184,856863;2020-04-18,1406,732242;2021-01-29,5955,512835;2022-12-08,9817,189756;2023-04-08,2483,392795;2022-12-05,1973,906850;2021-10-22,6414,528343;2021-12-18,4929,729590;2022-06-05,9881,693635;2022-10-24,337,382497;2022-02-25,2417,684073;2020-09-01,4805,142722;2023-02-16,4277,364287;2020-11-21,4258,682992;2019-11-04,1428,305544;2019-10-06,7482,890571;2023-03-02,7026,245790;2022-12-05,78,732890;2021-02-23,6744,600204;2020-06-09,8699,256933;2023-02-20,4215,91666;2022-11-03,3777,513626;2022-01-30,7735,52520;2021-12-02,9671,639050;2022-10-13,2325,115528;2022-02-22,641,162470;2021-06-29,9161,927587;2020-04-10,1339,309029;2021-03-06,6602,278628;2023-02-10,9400,117228;2020-10-27,9819,930680;2022-09-09,8336,130047;2022-01-30,4059,451140;2020-07-31,3440,657244;2020-10-31,815,204045;2023-08-23,528,449894;2020-11-20,4443,687309;2020-09-03,8549,264250;2021-12-04,6665,357733;2023-06-19,1387,857095;2023-08-23,8815,786659;2020-12-12,1484,213032;2020-03-22,8231,72738;2019-11-07,8572,794116;2022-08-28,8994,914087;2023-04-04,5922,495407;2021-07-15,8063,986283;2023-01-17,2733,648225;2021-02-20,8782,799587;2023-06-26,3046,85127;2020-07-20,2492,5549;2021-08-23,4194,725680;2022-09-24,5982,389574;2023-08-04,2863,417631;2021-06-21,3089,87329;2020-02-13,5635,880972;2021-01-23,623,41881;2022-01-22,6916,834842;2019-12-02,9903,812898;2019-11-22,1803,49279;2021-07-22,4235,295962;2021-08-27,9240,805760;2023-06-02,8164,516216;2021-08-22,144,772791;2020-05-02,2974,2242;2022-11-09,3148,395480;2021-01-04,9332,992888;2020-11-27,2394,432966;2023-02-04,258,746348;2022-08-02,1719,855526;2020-03-06,4686,798229;2022-11-21,4590,809144;2022-05-01,6888,251316;2020-11-20,9814,331380;2020-07-25,7666,24919;2021-06-28,5898,136897;2021-07-06,261,71551;2020-05-30,2161,823575;2021-02-04,2591,724688;2021-09-07,9138,126076;2021-04-11,4024,649254;2019-11-24,9750,197439;2020-08-20,710,193757;2022-08-24,6395,80011;2020-03-06,6898,661236;2019-12-23,9123,147752;2021-10-13,6864,278424;2021-04-19,4233,876696;2020-06-21,1341,644165;2021-03-23,7159,344225;2022-03-28,9154,728595;2021-01-08,722,101194;2020-09-25,3065,830708;2021-04-27,5687,245604;2020-10-31,1361,35623;2022-01-07,2975,714341;2020-01-18,6868,177828;2023-01-18,9971,735758;2022-09-07,6752,128977;2022-06-15,4183,973539;2019-10-03,7693,874271;2020-04-29,9800,498384;2023-03-02,2506,381520;2022-07-03,9022,335631;2022-10-28,8087,863478;2021-12-11,2029,971046;2019-12-11,1017,593196;2023-01-28,7834,905252;2021-12-21,3016,378606;2022-08-22,7953,906605;2022-09-16,9928,254478;2022-03-08,6406,905950;2020-05-03,9829,919740;2023-07-03,739,346903;2020-08-17,1527,379515;2023-01-09,1943,578346;2020-04-28,1167,380140;2022-07-09,6810,742441;2023-08-07,9470,845663;2020-06-21,7305,425547;2022-12-09,1982,702402;2022-10-11,6729,433239;2022-05-14,7878,696347;2023-03-18,6171,537929;2022-02-02,460,297527;2020-06-29,6220,481050;2019-12-05,3292,496380;2019-12-09,2322,835327;2022-06-14,8604,941001;2021-08-20,588,588880;2022-05-09,173,872616;2020-09-28,7075,117085;2023-01-27,5025,666654;2022-04-11,2854,927724;2023-05-21,2624,748632;2022-01-18,8949,542980;2021-05-22,8897,456640;2023-03-11,437,387983;2022-04-24,8638,324652;2020-10-19,325,20728;2020-01-31,6890,781188;2021-04-13,8301,50863;2022-01-31,2283,854849;2023-02-24,5360,194832;2020-10-04,982,726778;2021-09-16,6998,531060;2023-06-28,6722,54173;2022-06-12,4349,495195;2022-09-12,6819,230428;2020-12-04,6872,415200;2021-07-07,7823,43858;2020-05-25,823,996754;2020-10-12,2838,249178;2022-05-05,6447,241061;2020-03-27,100,42100;2022-04-20,3169,654637;2021-07-22,3142,25869;2022-04-02,2881,324263;2022-08-03,5251,300897;2022-09-12,3914,709642;2022-09-26,3194,6155;2019-12-18,7975,554870;2022-07-07,5565,124866;2022-10-06,277,913726;2021-06-11,7802,303802;2023-05-01,5359,891773;2023-01-12,7493,236687;2022-05-16,975,905620;2022-05-29,2436,117716;2020-05-27,2648,457577;2019-09-18,4130,769212;2020-10-10,4831,312021;2021-12-21,5852,350620;2022-04-01,4388,328866;2023-06-05,6926,531077;2023-01-17,2651,279354;2020-01-21,9224,82488;2021-02-17,957,702407;2020-09-06,4456,45760;2023-08-16,3596,507677;2022-10-03,3757,660887;2021-08-23,1999,738957;2022-01-01,1107,402243;2022-05-13,4095,614285;2022-02-18,6147,215722;2023-05-01,4480,468676;2022-02-12,4285,484849;2020-06-30,3613,462741;2021-03-18,9701,921262;2022-01-06,2350,881569;2021-10-12,3589,274860;2020-09-01,1546,401228;2021-04-09,2325,700508;2020-05-11,3360,231688;2022-12-08,4898,958821;2020-07-03,7090,342270;2021-08-23,1115,603985;2023-01-13,8244,989400;2020-11-30,4581,544385;2022-09-07,7684,389022;2021-06-07,8651,962350;2023-06-13,5899,389082;2022-04-10,7331,515455;2019-12-01,7156,578918;2022-10-09,1603,221238;2020-07-07,4449,489418;2020-09-29,9180,127273;2020-10-12,1973,173181;2023-05-10,3627,366640;2023-01-12,5046,398825;2021-02-04,346,739451;2020-07-17,9010,732495;2019-10-28,3028,388158;2023-07-13,2498,279813;2020-06-09,7753,530685;2022-07-07,2836,184048;2019-11-07,7470,218856;2022-05-13,223,44186;2022-11-29,8811,216768;2020-06-30,9255,90369;2023-07-16,8711,908740;2021-01-02,8531,130348;2023-06-05,9076,124073;2020-10-02,5324,815152;2022-01-12,7342,3500;2021-05-30,9842,846463;2021-01-28,5148,27173;2020-09-12,7965,625891;2021-11-12,1237,548655;2022-07-24,9863,518096;2020-07-15,5181,636232;2020-07-07,2005,934334;2023-04-30,6538,82946;2021-02-16,522,388282;2022-02-28,2767,343745;2019-11-26,60,976033;2020-03-18,56,411220;2021-02-27,8376,412688;2021-05-14,4194,916719;2020-10-19,8904,242407;2021-02-23,3914,612879;2022-02-14,7529,253756;2021-08-10,8540,516456;2021-10-23,4576,756738;2023-04-04,9303,551134;2023-04-08,7228,635548;2021-10-14,9381,152481;2021-02-11,6383,267200;2023-01-02,3121,966086;2021-06-10,3017,627661;2020-07-19,6607,402414;2022-04-05,345,80175;2023-08-02,3340,176814;2023-02-18,8914,142489;2021-10-01,3933,333911;2022-07-14,6169,101929;2020-03-07,3254,642538;2021-08-01,7403,345884;2021-09-02,3133,500665;2023-02-26,4013,737;2022-11-06,1563,512256;2022-07-09,1942,20744;2022-07-20,5812,765744;2022-03-16,5723,670630;2021-06-06,8726,225657;2022-08-15,2132,670294;2021-06-30,8747,839544;2022-04-18,1027,134757;2022-01-15,9007,894961;2022-11-28,7961,630603;2020-12-25,9756,643571;2023-06-11,6762,257218;2023-08-29,3874,931716;2020-12-26,9140,446924;2021-02-17,9188,796234;2022-11-23,8360,603720;2022-12-19,850,837139;2021-04-29,4416,325660;2021-06-27,5607,525152;2019-12-10,5235,300531;2020-02-02,2923,19821;2019-12-26,6734,127862;2022-12-05,7184,794578;2019-12-19,5673,925451;2023-07-09,1220,756958;2021-10-18,105,373051;2020-06-20,6134,488483;2023-03-28,5013,650503;2022-07-30,6137,852226;2023-03-29,2131,82041;2022-07-27,1905,185337;2020-11-28,5895,858930;2020-07-06,2608,999257;2022-03-23,5573,645895;2019-11-11,4367,760039;2021-02-01,6630,949172;2021-07-03,3393,34584;2022-06-06,8316,962628;2022-07-11,3486,95153;2022-01-04,3680,683701;2020-12-29,3137,384475;2020-04-03,6717,939359;2022-08-22,8454,647233;2022-12-07,4565,967805;2021-12-28,1960,490511;2021-08-07,7497,988042;2020-04-09,823,51307;2022-03-17,9471,354558;2022-08-17,7072,564047;2021-10-21,6839,900517;2021-07-05,3820,985737;2022-01-19,2134,782103;2022-04-03,8324,553604;2021-06-01,1153,141167;2023-02-14,7436,342713;2022-11-20,3378,29393;2020-04-24,3025,935180;2021-01-02,7235,390726;2021-02-04,9961,429927;2019-10-28,8162,601807;2020-11-17,5226,350326;2022-04-01,3516,493556;2020-06-12,4790,890501;2020-03-02,3982,771960;2022-03-21,6365,592325;2023-06-08,6601,325775;2022-05-21,5626,656737;2023-05-22,3858,478481;2022-06-30,6770,372949;2020-10-08,2544,865485;2023-05-20,1979,810781;2022-10-09,4105,875933;2021-05-07,3686,590130;2022-06-29,2302,525073;2022-03-27,7374,451560;2020-11-21,8853,894710;2020-03-01,1080,850723;2020-09-05,65,245017;2023-04-04,390,398402;2021-03-12,7065,650484;2021-06-01,8970,195456;2023-07-10,694,336997;2021-11-11,8382,137230;2022-03-03,7138,662905;2022-04-14,2718,389561;2021-03-06,8956,432828;2021-01-12,4177,270869;2021-10-13,3449,554445;2022-11-22,710,575213;2020-04-07,5843,461398;2022-04-28,6310,530065;2021-06-16,575,411230;2019-09-16,6126,18594;2022-08-12,9515,559603;2021-11-13,8735,193743;2019-10-05,3046,409896;2021-04-16,4779,19861;2021-10-22,5770,794446;2022-02-11,685,601115;2021-08-30,3823,916273;2020-08-05,825,960008;2020-09-28,6199,709416;2022-01-18,8837,906545;2021-05-26,3600,627044;2021-09-01,293,205742;2020-10-19,7129,319084;2022-09-24,6656,914795;2020-12-31,1845,503012;2020-02-11,2530,423577;2020-06-04,8507,484860;2023-02-14,9401,535215;2022-01-02,7951,420019;2020-05-17,6931,310649;2022-07-05,5761,17570;2023-02-12,6830,249095;2019-11-29,1696,937777;2020-11-25,5519,369569;2022-12-23,3417,883131;2021-06-13,4599,315443;2022-10-04,8927,47457;2019-12-16,7028,590946;2021-11-10,9031,732007;2021-07-29,2691,94510;2022-10-10,5232,615804;2021-12-28,9119,93228;2022-10-31,6377,95494;2023-03-18,5049,85798;2021-07-07,8129,376983;2021-03-31,1356,271537;2022-08-10,2287,385891;2023-06-18,197,426583;2021-01-18,8152,782277;2020-10-01,6952,869434;2020-11-07,7720,928687;2020-05-20,8709,949105;2022-10-01,2843,377704;2020-08-11,7224,592862;2023-04-27,2141,71664;2021-01-21,1890,552004;2020-09-03,6632,406649;2023-02-27,3952,114611;2021-07-01,1417,171050;2022-10-02,5153,225581;2021-01-13,4091,382373;2023-07-22,4803,185115;2022-02-10,6974,127998;2020-07-03,3524,653128;2021-03-13,7743,572786;2021-08-24,1964,73100;2019-11-07,2204,825154;2023-07-16,2705,435706;2020-09-26,5351,806970;2023-01-14,7995,620523;2020-10-19,293,696214;2022-08-21,587,981578;2023-02-17,388,754019;2020-03-19,7115,168672;2021-07-30,462,435885;2019-10-04,2359,240770;2021-11-06,3390,640522;2023-04-05,9406,544747;2022-01-28,8824,872399;2023-07-13,9356,302628;2023-08-22,4567,636958;2022-12-15,8246,43189;2022-01-10,4591,931600;2020-12-01,8075,148641;2023-04-19,381,915597;2023-02-10,2469,905120;2023-01-13,7113,313740;2022-06-25,7219,510821;2021-12-06,6535,99478;2019-09-24,2346,491540;2021-05-06,5484,241967;2019-11-08,3977,619909;2022-05-21,9416,634596;2020-03-18,8298,37885;2020-11-22,489,976977;2023-07-13,3396,969828;2022-09-15,2582,605360;2021-10-30,3421,658971;2022-07-26,5918,392930;2022-12-15,3800,481662;2021-06-15,6362,545928;2022-06-15,4038,109207;2022-09-07,6047,240807;2023-06-18,9812,411230;2023-08-13,9174,462459;2022-07-04,6542,149476;2020-08-16,3434,173721;2020-05-21,2098,871496;2022-09-20,7109,541753;2019-12-05,4677,256991;2021-12-16,1934,547585;2023-02-06,3253,993159;2022-04-12,7520,725435;2019-10-10,4071,425697;2020-05-02,5263,818393;2023-07-25,2106,728635;2021-07-30,2765,288735;2023-06-20,4650,321453;2020-11-28,2627,892016;2019-12-10,48,600167;2020-04-21,4319,403830;2023-02-16,5526,699042;2023-05-24,4081,691410;2022-05-10,5573,436788;2022-04-22,9792,860515;2022-05-03,4755,447855;2020-09-27,5486,567673;2020-03-24,7451,971932;2021-11-24,1618,455917;2020-05-04,6702,435043;2021-02-02,4073,259857;2022-08-29,5025,230304;2022-12-15,6088,760286;2020-01-12,4283,133555;2022-03-16,4164,936181;2019-11-19,4788,138012;2020-12-05,9099,789017;2020-01-07,874,29452;2021-03-09,9159,276782;2019-10-21,4382,539172;2020-01-08,3479,35810;2022-06-16,7508,295320;2021-04-15,8998,162396;2022-06-17,3645,167535;2021-02-11,5073,424935;2021-07-22,4985,646168;2019-10-13,8739,680149;2021-10-22,3921,970770;2022-11-03,4358,896591;2020-09-24,1701,159284;2023-01-13,7757,205163;2020-09-01,1759,237758;2023-03-07,6358,259221;2022-03-16,4545,886823;2022-06-28,8125,122786;2021-07-25,822,185170;2022-09-04,8864,186102;2023-06-20,2613,601638;2020-08-12,8386,380770;2021-09-05,255,441406;2022-07-19,3321,689915;2021-12-17,4450,616822;2021-06-02,1658,263719;2022-06-20,6693,202237;2021-11-08,7152,997139;2022-05-28,3600,82842;2020-12-22,8451,164437;2020-09-11,6179,793843;2020-05-07,1960,645637;2023-07-28,1119,745008;2019-10-03,6955,124980;2022-04-26,2283,342494;2020-08-21,6814,887060;2019-10-21,7314,476630;2020-02-09,3731,186051;2023-07-01,6642,403489;2022-01-28,2461,841324;2023-01-27,6485,168924;2019-09-15,1496,645501;2021-09-06,4486,846433;2019-09-26,4677,812293;2021-04-14,8728,579186;2022-06-29,342,628983;2022-05-28,2747,277725;2020-05-11,425,992249;2020-09-16,4649,747733;2020-06-24,5711,814665;2022-11-25,4546,75203;2021-01-02,7457,211720;2021-03-08,7319,501467;2020-01-06,5356,197446;2022-07-17,602,303854;2021-05-02,8854,213316;2020-08-03,8280,379793;2020-11-08,523,222502;2020-09-12,5783,34958;2020-02-24,5021,544074;2023-05-09,6718,119060;2019-11-26,7864,30084;2021-05-23,9877,572661;2023-07-08,7526,756829;2022-01-30,5884,38627;2022-08-07,9457,807763;2023-07-21,7985,681252;2022-11-15,8364,962576;2023-03-15,6588,863458;2021-07-13,6171,22016;2023-07-02,9138,876924;2023-03-19,595,512084;2022-02-21,8084,154188;2020-01-31,75,687857;2021-04-18,4503,270387;2022-02-11,7773,652545;2022-09-28,1823,592834;2020-09-16,161,362479;2019-11-16,7530,127268;2021-10-17,9968,617172;2023-01-11,2811,277521;2023-02-10,9505,731900;2023-02-27,6610,364412;2022-04-28,4049,282045;2022-02-27,1757,252143;2020-01-30,290,693675;2020-05-06,3528,309842;2021-02-26,9269,415620;2021-03-27,1925,935930;2021-11-30,3731,241079;2021-03-01,4380,43910;2022-03-05,5713,891179;2020-05-04,9260,569374;2022-07-18,6108,614844;2021-05-12,4430,814610;2019-11-07,7466,265772;2020-02-12,642,940849;2020-03-17,2834,619806;2022-05-23,4315,215658;2020-10-13,6406,889727;2022-08-14,5357,726529;2023-07-25,7568,562511;2021-09-07,4015,881831;2020-06-24,4457,383260;2020-06-20,2181,243957;2021-11-28,256,273162;2023-02-03,1369,635171;2023-06-17,3918,209680;2023-09-01,1915,901746;2021-01-13,3353,569024;2021-06-25,9073,641676;2022-08-31,1262,224778;2021-11-16,9760,849765;2019-10-08,6620,283428;2020-06-30,2981,886951;2020-04-07,8972,634165;2023-07-21,1018,142293;2020-06-26,8854,546292;2023-05-08,4649,908254;2023-02-26,180,477588;2021-11-26,4843,680715;2023-02-23,8309,40484;2023-07-01,7250,715285;2020-02-18,7179,774280;2021-05-04,6158,15697;2021-08-26,8220,784539;2022-07-11,1102,797137;2021-06-04,7448,591986;2022-04-03,4228,813793;2021-08-13,8158,84258;2021-09-14,9126,135461;2019-12-18,7967,989686;2021-12-17,2596,834311;2023-06-14,1855,630257;2020-12-17,926,806497;2023-03-22,4758,565822;2021-12-15,2621,81567;2022-11-04,2993,545417;2021-11-25,8806,51476;2020-04-02,4591,459286;2022-02-15,9067,828768;2021-02-01,1048,317043;2021-04-25,7099,874243;2020-09-14,7696,448223;2023-06-05,8094,520706;2020-06-05,5186,646452;2021-02-26,7871,704400;2020-09-12,4187,553551;2022-05-26,8635,373442;2022-10-31,635,238670;2021-01-15,8496,503777;2023-04-16,5959,50804;2021-03-09,7788,700147;2021-02-11,4059,603288;2022-09-26,7899,452808;2021-12-03,6311,95183;2023-08-16,4427,990591;2019-09-25,4268,80513;2022-01-31,4724,632990;2020-04-13,796,147684;2023-02-05,1642,299655;2019-10-11,2110,189175;2022-08-03,8092,472639;2019-12-22,6133,446440;2019-09-08,3045,721344;2020-09-20,4147,117231;2019-09-29,1668,622510;2020-12-28,5637,10007;2021-07-13,3182,399970;2020-03-29,9411,456063;2022-04-04,8048,97426;2021-08-29,532,626018;2019-09-20,1806,270252;2021-08-05,6021,295034;2020-06-22,7428,521301;2021-08-28,934,553541;2023-03-20,3713,182006;2019-10-27,4161,377345;2019-12-26,4796,510504;2021-04-09,9027,117403;2023-03-20,5562,563547;2021-09-30,6364,78062;2019-09-16,7238,126997;2021-03-02,4614,426453;2019-09-16,9134,365154;2021-04-23,4823,78514;2022-01-13,9800,656121;2022-06-14,8479,627000;2020-09-26,5604,570632;2021-04-03,6674,847543;2021-01-22,3960,883490;2021-02-26,1941,114279;2022-02-24,9067,829848;2020-01-24,6008,546148;2020-08-04,8127,863708;2019-09-30,8774,572748;2019-11-05,4260,684272;2021-11-29,388,392052;2023-01-23,5817,529607;2022-11-12,9012,151201;2020-06-09,3027,444390;2019-10-08,1101,174604;2019-11-21,1667,632763;2020-05-01,1051,902922;2023-03-08,9612,997792;2019-09-18,2229,861071;2023-02-27,6523,220700;2020-04-10,3125,295321;2022-08-24,8148,522212;2021-11-14,9831,112849;2023-09-06,2346,823945;2023-01-13,1983,661858;2019-11-07,6178,701018;2021-07-21,5004,839506;2020-02-24,3306,985320;2021-01-29,7368,92678;2020-06-21,2789,750842;2023-05-08,4421,296919;2022-11-03,7100,390179;2020-12-05,8934,40635;2022-09-21,763,258498;2022-02-05,6922,738109;2023-07-31,8084,177083;2019-12-18,8778,833040;2020-08-06,8105,667165;2020-08-27,5830,449914;2020-03-25,2565,688671;2023-05-11,3959,365617;2023-06-29,3137,28865;2022-08-07,9146,488912;2022-09-03,3682,188151;2021-11-17,9628,533092;2022-01-27,3063,828888;2021-09-05,5454,420827;2020-06-04,6522,306201;2023-06-28,52,641110;2020-10-11,5207,605137;2023-02-19,1137,338702;2022-05-11,7395,504294;2022-01-03,3872,298063;2022-03-09,6378,255123;2023-02-19,5569,809673;2021-05-06,5429,319057;2022-03-11,1136,460245;2022-09-27,7544,248755;2020-12-22,208,593024;2021-06-18,2028,493573;2020-03-22,7364,116117;2021-11-18,500,161077;2023-05-14,8404,296773;2021-05-17,154,629617;2020-08-02,8582,237989;2023-01-07,281,783919;2020-02-23,7894,924826;2022-10-08,6083,138723;2022-06-07,2834,323067;2021-04-19,6213,328183;2022-07-25,1083,560333;2021-07-19,4922,847690;2021-03-17,9062,370846;2019-10-27,7245,993369;2023-06-18,8473,897991;2020-07-02,533,279596;2021-05-18,1172,683427;2021-09-18,8215,523387;2021-04-13,7118,381382;2021-03-01,1064,787494;2021-09-15,7815,579930;2023-06-14,1927,33559;2021-02-17,6561,431113;2020-03-29,607,916733;2021-11-09,176,20010;2023-06-19,3474,913591;2020-07-25,6402,593290;2022-05-03,8804,833741;2022-09-08,4854,719678;2023-04-08,4698,909568;2023-01-19,9792,387612;2022-10-25,3752,345816;2021-12-23,3080,724081;2021-09-17,3079,782893;2022-08-12,5212,5865;2022-02-22,4504,683829;2022-10-12,7922,271952;2021-02-03,2671,111037;2020-04-21,9592,488395;2023-03-18,4848,229100;2022-08-27,7854,272283;2020-05-31,6394,218375;2023-07-27,5980,138449;2022-07-05,549,6663;2020-09-22,2116,170817;2020-01-17,4752,485679;2019-11-19,6281,810999;2023-03-28,4571,793711;2022-08-24,7633,236025;2020-04-23,4711,714317;2020-07-24,7058,267436;2023-03-19,1711,57765;2021-02-28,3037,346907;2020-03-17,5892,611991;2023-01-22,8196,817093;2021-05-27,1411,305778;2020-10-03,1507,483178;2022-01-16,4950,692150;2021-03-21,3229,181391;2020-09-15,513,442958;2020-02-22,6035,751504;2023-08-14,2872,172027;2022-04-19,8758,365639;2022-05-22,4208,305433;2021-05-19,6517,877540;2020-01-13,4067,473629;2021-05-19,6411,279000;2021-04-18,2747,184777;2021-05-06,3519,407794;2021-12-01,6229,114694;2020-01-22,9192,656938;2020-06-08,81,357339;2021-09-04,9826,561718;2023-01-23,451,423942;2019-09-30,7535,142558;2022-06-16,9581,430905;2019-10-03,2223,345775;2022-12-30,5775,609712;2019-11-26,8230,917513;2022-08-16,5966,627596;2022-09-08,9558,184999"""
desired_date, s = s.split(";", maxsplit=1)
m = max(
(w for w in s.split(";") if w.startswith(desired_date)),
key=lambda x: int(x.split(",")[-1]),
)
print(m)
Prints:
2022-09-08,4854,719678
Or:
... code as above
print(m.split(",", maxsplit=1)[-1])
Prints:
4854,719678
CodePudding user response:
You can try: print(max(data[requested_date].items(), key=lambda x: x[1]))
, which should return what you desire.
You code would look something like this:
import sys
def add_value(dict_obj, key, value):
if key not in dict_obj:
dict_obj[key] = list()
dict_obj[key].append(value)
# get maximum for specific day
def get_max(dic, date):
return max(dic[date].items(), key=lambda x: x[1])
if __name__ == "__main__":
input = input()
input = input.split(";")
requested_date = input.pop(0)
data = dict()
for d in input:
date, id, value = d.split(',', 2)
date = date.strip()
if not date in data.keys():
data[date] = dict()
data[date][int(id)] = int(value)
print(get_max(data, requested_date))