Skip to content

Instantly share code, notes, and snippets.

@dgadiraju
Created January 4, 2018 05:31
Show Gist options
  • Save dgadiraju/39ab42d29c28537525f3a71ab88585ee to your computer and use it in GitHub Desktop.
Save dgadiraju/39ab42d29c28537525f3a71ab88585ee to your computer and use it in GitHub Desktop.
kgislData = open("C:\\kgisl.csv").read().splitlines()
countByDegree = {}
for i in kgislData:
degree = "Engineering" if(i.split("\t")[3]
in ["CSE", "IT", "ECE"]) \
else "Non Engineering"
if(countByDegree.has_key(degree)):
countByDegree[degree] = countByDegree[degree] + 1
else:
countByDegree[degree] = 1 #{"CSE" : 1}
for i in countByDegree:
print(i + "\t" + str(countByDegree[i]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment