CodePudding user response:
You mentioned it's a CSV specifically. Read in the file line by line, split the data by comma (which produces a list for the current row), then if currentrow[3] == fuel type increment your count.
Example:
gas_cars=0
with open("data.csv", "r") as file:
for line in file:
row = line.split(",")
if row[3] == "Gasoline":
gas_cars = int(row[6]) # num cars for that car make
# ...
# ...
# ...