In: Computer Science
The attached csv, Projects.csv, has the grades for three projects of a class roster. Additional class data includes student first and last name and their age.
Your first task is to load the csv into a Pandas data frame. Afterwards, you must take steps to ensure no blank data persists in the data frame. Following that, you are expected to:
• Calculate the mean and standard deviation of the three projects and print them to standard output
• Create a letter grade column in the data frame and set the grade according to the value in the appropriate project column. Please do so using a function (hint: pandas makes this very easy!)
• Graph a bar plot for the letter grades for each project using seaborn. Please place all three projects on ONE graph, using a different color for each project. The graph should have an appropriate legend
• Create a dist plot of age(X axis) vs project numerical grade (Y axis) for all three projects. You may wish to use a FacetGrid to make this a faster process.
first_name,last_name,age,project_one,project_two,project_three Lindsey,Gerber,24,83,74,76 Claudetta,Samples,26,91,78,57 Cointon,Borrie,18,54,90,91 Lock,Boarer,26,70,104,60 Melita,Scaysbrook,19,87,68,65 Lianne,Grieveson,21,75,121,77 Benito,Cabotto,18,75,40,65 Trace,McCathy,23,68,76,67 Kareem,Arnaldy,26,62,94, Slade,Brymner,26,51,61,74 Antonetta,Jennery,,63,88, Inga,O'Concannon,24,84,95,83 Nicola,Johnes,19,58,70,69 Sheffie,Blackney,22,66,67, Sterne,Liger,25,67,69, Delmer,Emmison,21,77,71,77 Asher,McGaugie,19,92,93,78 Lauritz,McLorinan,20,50,92,72 Massimo,Bingle,21,76,70,59 Inglebert,Mewrcik,18,83,59,74 Sidonia,Linneman,25,89,67,63 Mabel,Bottoner,23,74,84,84 Chancey,Boller,18,103,83,78 Edmund,Dacres,20,80,68,90 Burch,Trillo,22,25,48,87 Giustina,Kirrens,26,66,53,73 Sascha,Lowmass,20,68,63,80 Eileen,Petts,22,91,74, Merrick,Dust,21,61,41,94 Darla,Ashingden,,84,83,71 Iggy,Langeren,20,90,61,80 Sal,O'Bradain,19,63,85,86 Hodge,Saffon,21,42,75,96 Dill,Thorburn,22,60,79,99 Georas,Collinson,26,78,24,62 Sherrie,Fairfoull,20,84,88,69 Niven,Geeve,23,88,79,71 Spense,Jakeman,26,101,43,75 Corrine,Jeavons,19,89,86,89 Darlleen,Besnardeau,18,107,107,64 Grazia,Bazek,19,63,76, Anatole,Corkitt,19,97,65, Evangelia,Lasty,26,74,49,71 Leshia,Rakestraw,19,72,29,61 Maureen,Cressey,26,89,98,67 Johnna,Govett,23,86,44,96 Suki,Dady,26,93,71,89 Agace,Myatt,18,71,112,91 Shari,Villaret,19,80,65,63 Becky,Jack,21,58,81,75 Merla,Cud,26,91,70,89 Artie,Tarburn,22,78,84,61 Bren,Frow,18,81,70,71 Judy,Dils,26,103,76,98 Arlan,Ligertwood,,63,94,77 Pia,Moorerud,26,68,74,59 Heidie,Males,23,71,55, Sterling,Drable,21,54,113,102 Cooper,Aberdalgy,18,74,85,84 Donnie,Vasilkov,18,63,79, Townsend,Krop,24,78,101,93 Hashim,Ascough,19,78,84,107 Sabina,Hilliam,18,72,62,84 Gwen,Hankey,21,90,95,84 Moira,Blanchflower,23,78,114,90 Patti,Fortman,25,74,85,89 Alvira,Indgs,21,38,57,62 Daffy,Barnby,19,82,87,91 Alfons,Laugier,20,68,79,84 Alvira,Cumbes,24,47,73,77 Gennie,Tremonte,19,63,43,114 Karoline,Papaminas,20,67,44, Blinny,Milillo,22,77,81,84 Cindie,Wyldbore,25,90,98,66 Holli,Thursfield,25,82,69, Paulita,O'Lehane,26,47,96,69 Vick,Killough,21,53,84,71 Micky,Toovey,24,87,79,87 Moselle,McGarva,20,75,107,95 Norby,Amies,18,98,56,80 Stefanie,Pennings,24,79,102,76 Cherise,Baish,26,77,52,55 Dallon,Loddon,26,88,98, Tore,Knolles-Green,21,79,80,75 Rafaelita,Sanbrooke,20,80,100, Matias,Skingle,22,48,81,82 Druci,Benedite,22,74,78,79 Pavia,Andrioletti,21,62,57,83 Tamas,Joynt,23,72,90,62 Zachariah,Pusey,20,56,99, Madelyn,Squires,25,52,48,61 Davey,Kmiec,,62,48,72 Dag,Ancell,19,76,101,82 Jerrome,McCudden,20,61,57,71 Rachele,Fermin,24,80,86,75 Evonne,Tevlin,26,52,115,76 Mersey,Ickovicz,23,74,39,77 Corri,Gulberg,26,101,95,86 Jehanna,Kinningley,,49,76,81 Parsifal,Bedome,18,75,95,87 Rosy,Hyam,21,41,67,67 Dalenna,Osipov,20,77,84,77 Ailene,Ruthen,22,91,65,78 Bran,Mulvey,24,95,80,62 Marwin,Hedditeh,23,89,89,69 Sam,Leere,20,58,80, Maxie,Benyon,26,63,106,91 Neely,Arboin,21,80,76,127 Port,Spilsbury,24,76,67,61 Layne,Cookman,19,92,56,50 Ranice,Mullard,25,83,63,100 Halley,Calltone,25,67,91,72 Ardelis,Lavalde,19,54,77,74 Gay,Wildish,25,86,93,101 Adey,Adame,20,68,74, Bambi,Etherington,19,91,63,82 Zaneta,Morsom,23,81,73,71 Shem,Humphries,25,68,81,94 Reginauld,Lisimore,22,88,113,96 Lynde,Furst,26,57,71,84 Shirline,Semorad,20,45,88,73 Maritsa,Ahrenius,,71,100,96 Helaine,Kelley,19,78,91,76 Haven,Harrigan,24,70,48,82 Caitrin,Droogan,22,86,73,38 Austen,Tittletross,24,98,101,80 Rudolf,Lamacraft,22,66,61,49 Tuck,Domenichelli,21,64,87,88 Wolfie,Strickland,24,88,63,103 Austina,Duce,23,88,84,46 Yoshi,Levinge,,84,112, Paola,Gresley,21,77,79,81 Merwin,Hiland,22,81,73,41 Carlota,Giorgi,20,79,84,43 Minette,Bezley,23,65,79,75 Minni,Lamont,18,91,76,73 Amelina,Betty,19,57,85,85 Nicola,Eckersley,26,69,46, Kerrie,Dengate,19,47,87,78 Shanda,Perris,25,75,82,82 Bowie,Kerbey,26,59,87,108 Delia,Holtham,25,70,74,79 Riobard,Bendtsen,22,49,75,99 Guinevere,Shelmardine,25,71,88,112 Derrek,Climance,21,71,88,99 Dexter,Nelsen,22,64,86,88 Durward,McElrea,20,92,85,76 Clarke,Crolla,23,76,95,80 Nadiya,Burkin,18,73,73,87 Alonzo,Rawles,19,87,80,89 Dall,McDermott-Row,20,83,97,96 Rudolfo,Le Grove,25,74,87,96 Layne,Stopforth,24,62,65,77 Prentiss,Minchinton,25,90,69,94 Jameson,Leakner,22,96,106,94 Hali,Filewood,25,63,63,60 Francis,Vines,26,68,64,78 Axel,Crumby,20,74,55,28 Porty,Shenfisch,22,66,96,92 Shurlock,Caillou,18,113,126,62 Andree,Skedge,23,71,61, Kingsley,Paler,18,62,61,88 Corliss,Alliot,25,77,95,122 Avram,Scobie,24,77,71,96 Madge,Coltart,24,50,69,78 Cordie,Bellson,,55,74,63 Amanda,Cartwight,25,69,52,83 Any,Gindghill,20,107,102,90 Cirilo,Richichi,23,48,85,83 Celinka,Donnan,22,69,75,61 Wright,Threlkeld,18,82,73,72 Flss,Feek,21,42,73,51 Krystyna,Winterburn,18,68,118,55 Birgitta,Constanza,24,54,95,105 Ferdinande,Tourry,22,71,83,62 Dolores,Riddel,18,64,71,76 Gretal,Nettleship,25,84,66,60 Perice,Winkett,22,62,69,77 Harriott,Loffel,25,86,109,88 Perl,Klimpt,23,96,74,65 Demetre,Huston,21,103,111, Vern,Allmen,26,72,86,65 Brant,Thrush,20,72,41,77 Yance,Martinyuk,24,61,90, Kin,Canet,22,81,67,82 Valina,Van der Velde,,87,96,84 Beverlie,Allen,21,86,88,92 Ann-marie,Reavey,20,89,71,74 Holly,Mellanby,21,63,66,72 Jeffrey,Claydon,24,63,68,74 Donia,Allso,18,73,34,75 Bronson,Haynes,19,77,101,95 Myrilla,Garrioch,25,84,44,57 Jodie,Clubb,19,62,44,71 Kalina,Mountfort,19,61,87,67 Felic,Robez,21,62,63,86 Florie,Masi,18,77,80,101 Joaquin,Tynemouth,19,71,54,88 Eadmund,Parrot,26,81,61,99 Mellisa,Keeri,19,57,61, Reidar,Morhall,23,75,77,65 Johnathan,Warwicker,22,75,90,79 Alix,Symones,19,61,61,66 Alia,Kirtley,21,53,81, Ulrike,Wackly,23,55,45,78 Hal,Pawellek,18,63,61, Charles,Abdey,20,81,72,81 Frants,Williams,26,82,86,81 Elberta,Jumeau,23,94,68,85 Dennie,Jersch,23,84,90,67 Noella,Shearsby,23,68,89, Edeline,Albrook,26,51,57,64 Danila,Dunrige,23,101,122, Rowena,Woltman,18,88,55,89 Lawrence,Ricold,21,97,38, Malissia,Coldbathe,,85,45,85 Pamella,Roussell,22,68,87,93 Katha,Adelman,18,79,57,79 Celestyn,Absolon,22,79,58,57 Hermy,Dumbrell,25,81,105,93 Lindy,Smees,19,62,89,91 Jeddy,Camlin,19,41,80,78 Marcello,Springford,24,58,103,70 Chrissy,Colbeck,23,81,99,77 Pascal,Kuhnke,25,96,81,98 Gearalt,Bramelt,26,72,70,72 Harold,Tieraney,26,65,69,79 Zonda,Aitken,21,66,86,67 Mair,Orrice,19,83,89,83 Maudie,Smiley,19,76,64, Sidoney,Currer,21,76,96,82 Des,Theuff,25,71,129,82 Wat,Willett,22,68,76,117 Carmelle,Gresch,26,84,98,99 Rik,Tootin,21,47,67,103 Donn,Lintin,23,83,93, Thomasin,Narramor,22,68,70,101 Jeanna,Bartlam,20,56,130,88 Griselda,De Filippo,19,66,76,72 Rhonda,Hancke,21,71,101,81 Terri,Rope,22,93,20,76 Fraser,Marshman,20,57,51,85 Jandy,Gostick,24,66,82,92 Joshia,Kingsnod,24,77,86,63 Antoni,Buzek,25,63,118,87 Freddie,Ruddlesden,20,83,93,78 Lanie,Bruin,21,88,49,96 Tally,Willmont,20,82,90,84 Annis,Shawl,18,59,78,68 Glenda,Corteney,23,51,82,92 Arleyne,Concannon,21,49,106,87 Dyan,Hoffner,19,83,102,75 Fredi,MacCrann,22,84,70,65 Beverlie,Pesselt,22,73,59, Guillemette,Blackborough,25,67,86,83 Shalna,Jordine,26,99,102, Dasya,Goracci,18,88,84,89 Lyda,Attridge,24,72,78,92 Ulrica,Lory,18,69,79,89 Emlynne,Kedge,26,93,84,60 Gerry,Wetherburn,,64,91,104 Vilhelmina,Myles,22,73,99, Faustina,Ullyatt,19,75,88,67 Ennis,Paule,22,97,133, Willard,Eggleson,19,63,73,77 Ericka,Housego,24,76,50,76 Carmelita,Batterton,24,36,69,66 Rosetta,Farfalameev,21,95,80,89 Axel,Blasgen,23,98,111,77 Marcile,De Roeck,21,82,67,105 Vale,Slatcher,25,69,95,84 Shaylynn,Olland,26,56,96,78 Eydie,Credland,19,80,51,96 Bennett,Delion,21,78,60, Dennis,Agiolfinger,20,79,66,76 Clotilda,Ivakin,19,69,38,55 Milissent,Witty,18,80,69,80 Hugh,Glackin,26,73,71,91 Ulysses,Road,25,86,94,65 Flin,Rosenstiel,20,61,97,93 Nedda,Piercy,21,69,93,76 Randie,Bartlett,18,89,76,100 Mohammed,Fippe,19,76,70,42 Cilka,Garnham,23,75,91,92 Mendy,Garm,26,75,137,105 Geordie,Etuck,22,52,101,84 Talbert,Outridge,25,69,114,70 Adolpho,Zannotelli,23,94,61,103 Gus,Dollimore,21,53,70,97 Emelia,Vogele,20,75,82,100 Nikkie,Parsonson,23,87,62,83 Gabie,Comiam,19,59,38,92 Andrew,Petrasso,,43,84,54 Lissa,Trengove,20,71,69,78 Marika,Flobert,,90,33,85 Leanor,Muro,22,73,89,79 Nicolai,MacLise,20,53,88,78 Jard,Postles,21,74,73, Jeni,Fishly,18,85,93,94 Dorelia,Chasles,26,92,64,75 Englebert,Phillcox,23,81,37,59 Dominic,Caird,18,79,77,82 Lorenzo,O' Hogan,18,106,84,57 Freddy,Illwell,23,84,63,68 Ediva,Call,19,65,79, Nikolas,Clemonts,21,79,58,81 Elissa,Cudbird,25,95,76, Jacklin,Hartrick,22,46,74,88 Michelle,Doxey,18,79,96,66 Everard,Poles,20,69,97,76 Davy,Trolley,21,77,100,80 Laure,Campione,19,75,71,83 Marijo,Ganing,20,60,82,85 Levey,Delion,18,64,46,95 Mariejeanne,Garthshore,24,97,97,93 Phelia,Salthouse,25,98,88,84 Shelden,Featherbie,22,102,87,100 Burnard,Sarson,20,57,105,75 Tabbi,de Juares,20,77,96,80 Boycie,Karppi,20,58,101,60 Freddy,Goady,20,63,102,83 Suellen,Brizell,25,80,100,91 Minetta,Hamberston,25,90,104, Hymie,O' Kelleher,23,70,131,90 Sonja,Goodley,19,98,96,79 Carena,Marousek,26,59,82,77 Karoly,Rettie,21,81,70,86 Cameron,Clayton,24,79,82,68 Rouvin,Stinchcombe,18,73,118,47 Fransisco,Breyt,22,37,87,67 Kerry,Hurrion,25,32,123, Kirstyn,Willshaw,22,60,75,87 Evered,Folcarelli,19,75,58,54 Allys,Tebbe,19,78,103,104 Gwendolyn,Spelsbury,26,81,74,92 Kellie,Gilstoun,18,64,47,90 Jocko,Cordet,21,101,47,73 Granny,Poluzzi,22,87,89,56 Patsy,Zorzenoni,21,76,84,74 Elbert,Grubb,24,82,44,68 Arie,Jekel,19,85,44,89 Linnea,Polini,26,74,63,80 Laurence,Hairon,26,52,88,110 Nicol,Hiom,18,77,90,73 Lou,Fowlds,18,94,90,75 Hallie,MacAlaster,26,59,52,88 Shepherd,Cadge,,54,74,76 Ainsley,Galland,21,74,67,84 Feliks,Lighterness,,86,95,71 Britni,Keeley,22,80,95,79 Conchita,Leirmonth,23,82,84,66 Eddi,Spiring,26,92,86,98 Jarrad,Mournian,20,92,87,79 Shadow,Labrom,20,97,92,65 Giacopo,Delacourt,23,87,94,82 Mozes,Bloor,23,76,85,71 Ellynn,Syrett,25,62,80,48 Crawford,Comiskey,26,75,80,81 Ignacio,Shelley,24,70,69,68 Aldwin,Longbone,26,69,50,93 Dewitt,Michallat,25,54,81,77 Carita,Zaczek,26,88,77,65 Dennison,Liddicoat,25,53,90,80 Nicol,Jiroudek,24,73,47,64 Hervey,Goldstein,,88,74,74 Carolan,McIlwaine,24,87,68,81 Olly,Tandy,22,81,43,85 Barbie,Canet,23,94,83,82 Trisha,Corballis,23,77,72,64 Bianka,Moggle,19,79,68,75 Aaren,Worsalls,19,86,56,72 Donavon,Chestle,19,75,69,90 Jorie,Olufsen,23,117,28,100 Nissy,Falkner,21,64,75,64 Kenneth,Vader,19,97,103, Roldan,Rennicks,22,75,74,71 Manolo,Pelcheur,18,66,98,86 Tony,Rollins,20,72,97,89 Harli,Lightowlers,19,83,72,55 Claudian,Worstall,24,67,81,93 Rochell,Braddick,21,68,68,67 Opal,Fetherby,26,80,71,70 Meara,Scanderet,23,67,35,94 Lars,Merwood,24,60,85, Melli,Hubatsch,26,84,94,76 Shelton,Insull,21,92,96, Lenora,Cutchee,26,112,85,89 Alejandra,Newby,25,92,81,83 Gusta,McGlaud,25,62,91,122 Dulcinea,Osipov,21,96,34,73 Earlie,Mickelwright,24,77,55,81 Willabella,Rubens,19,60,92, Ara,Emanson,22,63,81,74 Camilla,Duddle,22,88,84,68 Felipa,Ledson,21,75,98,73 Nobie,Skells,18,50,90,99 Bryana,Stilling,19,61,76,74 Lorens,Sharkey,18,68,66,92 Ward,Staning,25,75,83,78 Colline,Domenico,21,81,87,84 Hewett,Hurst,22,79,91,68 Sammy,Malcher,,72,100,80 Nicolas,Rowell,19,76,93,74 Addia,Roome,25,75,60,100 Alberta,Tessier,20,77,69,78 Octavia,Oboy,19,70,121,68 Elvera,Suff,25,83,71,80 Dannye,Tees,26,74,72,87 Petr,Dibdall,22,68,106,79 Benny,Hapgood,23,82,80,61 Elsworth,Jans,20,54,78,80 Mendy,Sessuns,26,67,67,73 Alfons,Janusz,20,81,85,74 Gare,Treacher,18,59,78, Agna,Maden,26,57,63,65 Tailor,Witter,,74,80,100 Christy,Duigan,22,71,50,71 Tallia,Edwards,23,120,91,41 Janka,Teodoro,23,82,79,56 Ileana,Ruffli,22,73,50,57 Dominik,Lago,19,72,80,101 Jordain,Stenners,26,66,59,103 Nikaniki,Joss,18,92,37,85 Vittorio,Dearnley,24,75,83,102 Poul,Kail,19,68,83,50 Gale,Rhydderch,22,104,76,72 Rachel,Winstanley,20,65,66,69 Andros,Hincham,21,51,100,85 Dael,Goudard,18,51,105,104 Rosene,Allinson,21,81,118,65 Kirsteni,Bootell,20,50,62,81 Jaime,Hischke,,65,99,79 Biddie,Dumblton,26,59,92,72 Aridatha,Vossing,20,43,70,90 Estelle,Witham,20,104,110, Colan,Geddis,22,61,71, Seamus,Leggott,25,63,83,86 Bonny,de Lloyd,22,71,72,72 Tamra,Froggatt,20,36,139,83 Linette,Purchall,24,51,70,67 Obediah,Boyington,21,70,78,93 Guss,Ivermee,18,59,100,54 Niall,Bettleson,25,78,106,73 Adriena,Teggart,23,73,78,88 Giacobo,Mazdon,24,79,114,93 Anita,Corris,21,50,91, Julie,Tippings,24,82,72,75 Fania,Willavoys,23,67,69,84 Giacobo,Stedall,22,95,105,96 Evvy,Mattholie,25,62,74,80 Naomi,Jiggens,,72,98,90 Iago,Bonny,24,111,69,87 Jerry,Beisley,18,69,89,45 Olivero,Casarini,25,83,47,94 Krystyna,Biever,24,81,111,57 Beverley,Lawerence,19,72,64,61 Gusti,Cain,,63,63,84 Britte,Moehler,25,96,67,78 Gwenneth,Golbourn,18,89,58,75 Tibold,Mollett,18,69,72, Edgardo,Favill,18,87,85, Conny,Rauprich,21,76,81,48 Meredithe,Apfler,21,93,70,86 Shepard,Stuart,21,78,81,78 Caritta,Scare,21,83,58,89 Bernard,Franzke,22,81,102, Ruthy,Ceeley,26,53,62,68 Gill,Skellon,23,66,96,49 Betsy,Reddings,19,48,111,83 Rhody,Calverley,23,88,53, Bevin,Haggart,25,66,86,83 Stan,Corp,22,60,102, Nickolas,Dawltrey,19,87,82,77 Ursulina,Pape,20,74,70,67 Noell,Stenhouse,23,93,51,102 Sisely,Cheak,21,84,69, Sigismund,Longforth,19,88,26,98 Terencio,Lilleyman,22,86,73,90 Carlie,Boseley,20,95,87,82 Philippine,Ewington,26,97,106, Jacki,Racine,23,69,72,109 Rees,Boshard,23,73,47,79 Bernardine,Rubbens,19,37,78,53 Sammy,Edess,18,77,67,69 Lucais,Curtoys,22,72,111,123 Mathilde,Adamovitch,25,89,52,106 Lombard,Murrthum,26,93,81,93 Casey,Tatershall,25,114,100,82 Maia,Johnys,19,70,80,62 Ailsun,Shyres,20,88,84,87 Ricoriki,Such,19,84,89,70 Crissie,Gauford,,88,85,99 Conroy,Fosdick,23,52,82,84 Marlo,O'Quin,23,73,91, Shaine,Barrass,21,67,56,96 Kelci,Deakins,18,78,69,77 Fedora,Rubel,22,84,67,78 Aime,Torre,20,64,82,69 Lola,Meadmore,18,58,41,72 Reuben,Arrell,22,82,76,89
// In the following program, we will cover the first two subparts of the question.
PROGRAM -
// Importing libraries,
// Pandas is used to read the CSV file into a data frame.
// Numpy and SimpleImputer are used to replace the missing values.
import numpy as np
import pandas as pd
from sklearn.impute import SimpleImputer
// Reading data from CSV files
data = pd.read_csv('File Path')
X = np.array(data)
// Replacing Missing Values from average of each
column
imputer = SimpleImputer(missing_values=np.nan , strategy =
'mean')
// As first two columns contain the name and last name X[:, 2:] is used ranging from the second column to //last column
imputer.fit(X[: , 2:])
X[: , 2:] = imputer.transform(X[: , 2:])
new_data = pd.DataFrame(X)
// Calculating mean and standard deviation of each project
mean_1 = new_data[3].mean().round(2)
mean_2 = new_data[4].mean().round(2)
mean_3 = new_data[5].mean().round(2)
std_1 = new_data[3].std().round(2)
std_2 = new_data[4].std().round(2)
std_3 = new_data[5].std().round(2)
print('Mean and Standard Deviation of first project are : ' , mean_1 , std_1)
print('Mean and Standard Deviation of second project are : ' , mean_2 , std_2)
print('Mean and Standard Deviation of third project are : ' , mean_3 , std_3)
// Assigning letter grade to each project for every observation.
score_bins = [0 , 59 , 62 , 69 , 72 , 76 , 79 , 82 , 86 , 89 ,
99 , 120 , 150]
grades = ['F' , 'D-' , 'D+' , 'C-' , 'C' , 'C+' , 'B-' , 'B' , 'B+'
, 'A-' , 'A' , 'A+']
letter_a = pd.cut(new_data[3] , score_bins ,
labels=grades)
letter_b = pd.cut(new_data[4] , score_bins , labels=grades)
letter_c = pd.cut(new_data[5] , score_bins , labels=grades)
new_data[6] = letter_a
new_data[7] = letter_b
new_data[8] = letter_c