Skip to content
Snippets Groups Projects
Commit 55631852 authored by David Hrbáč's avatar David Hrbáč
Browse files

All modules sort and code II

parent adca103a
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/python #!/usr/bin/python
import csv import csv
import collections
def get_data(filename): def get_data(filename):
'''function to read the data form the input csv file to use in the analysis''' '''function to read the data form the input csv file to use in the analysis'''
...@@ -14,7 +15,6 @@ your_list = [] ...@@ -14,7 +15,6 @@ your_list = []
your_list += get_data('modules-anselm.csv') your_list += get_data('modules-anselm.csv')
your_list += get_data('modules-salomon.csv') your_list += get_data('modules-salomon.csv')
#print your_list #print your_list
your_list.sort()
a=[["python/2.8.1",1],["python/2.9.1",2],["python/2.8.1",4],["python/3.0.1",4]] a=[["python/2.8.1",1],["python/2.9.1",2],["python/2.8.1",4],["python/3.0.1",4]]
counts = dict() counts = dict()
...@@ -23,7 +23,7 @@ for i in your_list: ...@@ -23,7 +23,7 @@ for i in your_list:
#print int(i[1]) #print int(i[1])
counts[i[0]]=counts.get(i[0], 0) + int(i[1]) counts[i[0]]=counts.get(i[0], 0) + int(i[1])
#print counts #print sorted(counts.items())
c=[ c=[
"---", "---",
...@@ -39,6 +39,7 @@ c=[ ...@@ -39,6 +39,7 @@ c=[
print "| Module | Clusters |" print "| Module | Clusters |"
print "| ------ | -------- |" print "| ------ | -------- |"
for m,i in counts.iteritems():
for m,i in sorted(counts.items()):
print "| %s | <code>%s</code> |" % (m,c[i]) print "| %s | <code>%s</code> |" % (m,c[i])
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment