Question: I need to do the following: Read students' result data from file result.csv, display: students with exam score < 48. Please also save the students'
I need to do the following:
Read students' result data from file result.csv, display:
- students with exam score < 48. Please also save the students' records to a file called failedhurdle.csv.
- students with exam score < 48 and total > 50
- students with exam score > 100
Sample code for as far as I gotten:
import csv
import pandas as pd
import numpy as np
df = pd.read_csv('result.csv')
columns = df.columns
with open('result.csv') as myFile:
reader = csv.reader(myFile)
for row in reader:
print(row)
Now this only prints all the number in the file but how can I just read those specific scores and write to a new file? Any guidance would be great.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
