SciSciCollective / pyscisci

Science of Science
MIT License
165 stars 22 forks source link

KeyError: 'Thesis' during mymag.preprocess() #10

Closed tomleung1996 closed 3 years ago

tomleung1996 commented 3 years ago

Hi, I was following the codes in Getting Started with MAG.ipynb but encountered this error when the program was preprocessing the Publications. I was using the 2021-05-24 version of MAG and didn't change any things.

Could you help me with this problem?

KeyError                                  Traceback (most recent call last)
<ipython-input-8-62f48396d725> in <module>
      3 
      4 # we only need to run this for the first time, but it will take awhile
----> 5 mymag.preprocess()

/usr/local/lib/python3.6/site-packages/pyscisci/datasource/MAG.py in preprocess(self, dflist, show_progress)
     64 
     65         if 'publication' in dflist:
---> 66             self.parse_publications(preprocess = True, show_progress=show_progress)
     67 
     68         if 'reference' in dflist:

/usr/local/lib/python3.6/site-packages/pyscisci/datasource/MAG.py in parse_publications(self, preprocess, num_file_lines, preprocess_dicts, show_progress)
    280                     # split the line and keep only the relevant columns
    281                     sline = line.replace('\n', '').split('\t')
--> 282                     pline = [load_int(sline[ip]) for ip in pub_int_columns] + [sline[ip] for ip in pub_str_columns] + [doctype[sline[3]]]
    283                     pub2year[pline[0]] = pline[1]
    284                     if doctype[sline[3]] != '':

KeyError: 'Thesis'
ajgates42 commented 3 years ago

Ah! Thesis is a new type. thanks for catching it.