Skip to content

Instantly share code, notes, and snippets.

@eruffaldi
Created January 27, 2016 12:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eruffaldi/852829d15848eb1bd8f5 to your computer and use it in GitHub Desktop.
Save eruffaldi/852829d15848eb1bd8f5 to your computer and use it in GitHub Desktop.
Tool for analyzing the GEV09 classification in VQR 2011-2014
#Emanuele Ruffaldi 2016 Scuola Superiore Sant'Anna
import csv,os,sys
from pyexcel_xls import get_data,save_data
all = []
#Year TopicId Topic Filename Titolo Rivista Codice identificativo SCOPUS valore SJR classe A classe B classe C classe D classe E IR in alto IR in basso
#4 + 3 + nclassi +
total = 4 + 3 + 5 + 2 +1
key2pos = {
"Titolo Rivista": 4,
"Codice identificativo SCOPUS":5,
"valore SJR": 6,
"classe A": 7,
"classe B": 8,
"classe C": 9,
"classe D": 10,
"classe E": 11,
"IR in alto":12,
"IR in basso":13,
"IR": 14
}
all1 = ["" for i in range(0,total)]
all1[0] = "Year"
all1[1] = "TopicId"
all1[2] = "Topic"
all1[3] = "Filename"
for k,v in key2pos.iteritems():
all1[v] =k
all = [all1]
for y in range(2011,2014+1):
name = "GEV09-Scopus-anno%d-SJR-Article" % y
for k in os.listdir(name):
if not k.endswith("Article.xls"):
continue
#GEV09-scopus-2207-Control and Systems Engineering-anno2013-SJR-Article
a = k.split("-")
id = a[2]
topic = a[3]
prefix = [y,id,topic,k]
data = get_data(os.path.join(name,k))
data1 = data[0]
data = data[1:]
if len(all) == 0:
all = [prefix1+data1]
for x in data:
xo = prefix + ["" for i in range(0,total-4)]
for i,k in enumerate(data1):
xo[key2pos[k]] = x[i]
all.append(xo)
print len(all)
print all[0]
print all[1]
data = dict()
data["Sheet 1"] = all
save_data("all.xls", data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment