I have multiple CSV files which were generated from a keyword based SQL query. I now have to write a code which will read in a CSV file and take a keyword as input and display an output in terms of how many times the keyword appears in said file and where it appears. I have uploaded a sample file and below is the beginning of my code that I have so far.
- Code: Select all
mRNA = collections.Counter()
with open('mrna.csv') as input_file:
for row in csv.reader(input_file, delimiter=';'):
mRNA[row] = 1
print 'Number of times mRNA is Repeated: %s' % mRNA['mrna']