- Credit Task 3 2c Process Data Using Pandas Task Description You Are Given A Student Result Data File Result Withoutto 1 (161.77 KiB) Viewed 23 times
Credit Task 3.2C: Process data using Pandas Task description: You are given a student result data file (result_withoutTo
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
Credit Task 3.2C: Process data using Pandas Task description: You are given a student result data file (result_withoutTo
Credit Task 3.2C: Process data using Pandas Task description: You are given a student result data file (result_withoutTotal.csv). It has columns ID: student id Assi - Ass4: assignment scores (out of 100); weight of assi, ass2, ass3 and ass4 is 5%, 15%, 5%, and 15%, respectively. Exam: examination score (out of 120); weight is 60%. ID Ass3 85 1 2 3 4 5 5 Ass1 89.1 95.1 74.3 89.8 91.3 Ass2 50 82.5 54.4 81.3 98.8 90.5 63 82 92.5 Ass4 88.9 94.5 63.9 90.4 95.9 Exam 65 52 31 37 79 (The above data is for demonstration purposes only. Please download the full version of result_without Total.csv.) Total score can be calculated using formula: Total = 5%*(ass1+ass3) + 15%* (ass2+ass4) + 50%"exam (as exam is out of 120) + Read students' result data from file result_without Total.csv, add: Total column: Total = 5%* (ass1+ass3) + 15%* (ass2+ass4) + 50% exam. Final column: Final = Total score rounded to the nearest integer. To pass the unit, a student must achieve at least 50 of the Total and 40% of Exam which is 48 out of 120 (or Total >= 50 and Exam >= 48). If a student failed the hurdle (Exam >= 48), the max Final is 44. No change to Final score if Final <44 already. Grade column: N(Final <=49.45), P (49.45 < Final <=59.45), C (59.45 <Final <=69.45), D (69.45 < Final <=79.45) and HD (79.45 < Final). Border values are as follows: . HD D C 79.45 69.45 59.45 49.45 P N save: the result data file with the 3 new columns to a file called result_updated.csv. the students' records with exam score < 48 to a file called failedhurdle.csv. < . display: the result data file with the 3 new columns the students with exam score < 48 (these who failed the hurdle) the students with exam score > 100 • the result data file with the 3 new columns • () the students with exam score < 48 (these who failed the hurdle) the students with exam score > 100 (Hints: import pandas, use DataFrame, DataFrame.loc and display) ) (Sample output as shown in the following figure is for demonstration purposes only.) result_updated: Ass2 Ass3 Ass4 Exan Total Final Grade Assi ID 1 89.1 2 95.1 3 74.3 4 89.B 5 91.3 6 83.9 7 81.5 8 50. 9 990.5 10 89.0 11 96.6 50.0 85.0 82.5 90.5 54.4 63.9 81.3 82.0 98.& 92.5 82.5 89. 50.0 68.5 54.9 50. 65.9 50.0 89.9 94. 100.0 98.0 88.9 94.5 63.9 90.4 95.9 98.6 95.4 87.7 72.2 90.3 97.3 65 62.640 52 61.830 31 40.110 37 52.845 79 77.895 68 69.810 59 58.830 51 51.890 63 59.240 84 78.180 102 90.325 62 62 40 44 78 70 59 52 59 78 90 C c N N D D P P P D HD failedhurdle.csv: ID Ass4 Exam 63 63.9 82 90.4 53 81.9 71 87.7 73 88.9 78.1 Ass1 Ass2 Ass3 3 74.3 54.4 4 89.8 81.3 15 66.3 53.7 24 57.7 76.3 --- 25 84.7 65 26 84.7 53.8 33 64.2 50 42 81.5 43.8 44 71.9 61.3 47 50 71.3 54 76.1 50 60 73.9 53.2 78 52.9 53.2 75 18 Total Final 31 40.11 37 52.8.45 30 41.305 35 48.535 34 47.97 36 45.77 0 11.61 0 10.645 38 49.765 34 47,065 33 37.805 34 46.76 36 38,625 Grade 40 N 44 N 41 N 44 N . 44 N . 44 N 12 N 11 N M 44 N 44 N 38 N 44 N 39 N 0 0 76 56 50 0 94.5 93.8 50 95.9 50 74 50 Display output: students with exan score ( 48 Assl Ass2 AS53 Ass4 EXAM Total Final Grade ID 3 74.3 54.4 63.0 63.9 31 40.110 40 N 4 89.8 81.3 62.0 90.4 37 52.845 44 N 15 66.3 53.7 53.0 81.9 30 41.385 41 N 24 57.7 76.3 71.0 87.7 35 48.535 44 N 25 64.7 65.2 73.0 88.9 34 47.970 44 N 26 64.7 53.8 75.0 78.1 36 45.770 44 N 33 64.2 50.0 18.0 0.0 0 11.610 12 N 42 81.5 43.8 0.0 0.0 0 10.645 11 N 44 71.9 61.376.0 94.5 38 49.765 44 N 47 50.0 50.0 71.3 56.0 93.8 34 47.065 44 N 54 76.1 50.0 50.0 50.0 33 37.805 38 N 60 73.9 53.2 74.0 95.9 34 45.760 44 N 78 52.9 53.2 50.0 50.0 36 38.625 39 N students with exan score > 100 Ass1 Ass2 Ass 3 Ass4 Exam Total Final Grade ID 11 96.6 100.0 98. 97.3 102 90.325 90 HD 84 93.6 100.0 96.a 100.0 106 92.480 92 HD