-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPublication Info.py
52 lines (32 loc) · 1.08 KB
/
Publication Info.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# coding: utf-8
# In[ ]:
from crossref.restful import Works
import pandas as pd
# In[ ]:
File = input("Enter file type: ")
if File == 'xlsx':
FileLoc = input("Enter complete file path: ")
df = pd.read_excel(FileLoc)
else:
print("Not valid")
# In[ ]:
#Works is a function in Crossref that allows access to a variety of metadata for publications
pub = Works()
# In[ ]:
for index, row in df.iterrows():
#.doi() is a function under Works() that delivers information
#based on the publications' DOI.
x = pub.doi(row['DOI']) #finds DOI info for each cell of the DOI column
if x is None: #handles cells that do not have DOIs or incorrect DOIs
print(index, '')
else:
a = x["created"]["date-parts"]
b = str(a).strip("[[]]")
print (index, b, end ='\n')
# In[ ]:
for index, row in df.iterrows():
x = pub.doi(row['DOI']) #finds DOI info for each cell of the DOI column
if x is None: #handles cells that do not have DOIs or incorrect DOIs
print(index, '')
else:
print (index, x['publisher'] , end ='\n')