Closed astrochun closed 2 years ago
I've been looking for these collaborations for a while - glad you found them. I continue the discussion in #243 .
Understand that this is a difficult fix, but I pulled your latest changes and tried with the above example and it did not work:
from pybliometrics.scopus import AbstractRetrieval
sc_abs = AbstractRetrieval('10.1038/s41586-021-04023-y', id_type='doi', view='FULL')
sc_abs.authorgroup
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-3-efbfec392583> in <module>
----> 1 sc_abs.authorgroup
~/codes/PPPL/pybliometrics/pybliometrics/scopus/abstract_retrieval.py in authorgroup(self)
73 try:
74 collab_idx = keys.index("collaboration")
---> 75 collaboration = items.pop(collab_idx)['collaboration']
76 except ValueError:
77 collaboration = {'ce:indexed-name': None}
IndexError: pop index out of range
I'm using 43413a9 of master
Indeed, my approach didn't work. What's different here is that authors still do have an affiliation.
Thanks. Can confirm that the latest commit is a cleaner solution (works). When is the next PyPI release?
Question: Has this issue been resolved? I ask because I attempting to use pybliometrics
on the same DOI above and the collaboration
field is simply None
.
For me not:
>>> from pybliometrics.scopus import AbstractRetrieval
>>> sc_abs = AbstractRetrieval('10.1038/s41586-021-04023-y', id_type='doi', view='FULL')
>>> import pandas as pd
>>> df = pd.DataFrame(sc_abs.authorgroup)
>>> df.collaboration
0 the W7-X Team
1 the W7-X Team
2 the W7-X Team
3 the W7-X Team
4 the W7-X Team
...
449 the W7-X Team
450 the W7-X Team
451 the W7-X Team
452 the W7-X Team
453 the W7-X Team
Name: collaboration, Length: 454, dtype: object
For me not:
>>> from pybliometrics.scopus import AbstractRetrieval >>> sc_abs = AbstractRetrieval('10.1038/s41586-021-04023-y', id_type='doi', view='FULL') >>> import pandas as pd >>> df = pd.DataFrame(sc_abs.authorgroup) >>> df.collaboration 0 the W7-X Team 1 the W7-X Team 2 the W7-X Team 3 the W7-X Team 4 the W7-X Team ... 449 the W7-X Team 450 the W7-X Team 451 the W7-X Team 452 the W7-X Team 453 the W7-X Team Name: collaboration, Length: 454, dtype: object
Not sure what happened but I'm getting the same now.
I presume this issue has been solved. However, i get a key error on the 'collaboration':
File ~\Anaconda3\envs\leadership_review\lib\site-packages\pybliometrics\scopus\abstract_retrieval.py:75, in AbstractRetrieval.authorgroup(self)
73 keys = [k for x in items for k in list(x.keys())]
74 if "collaboration" in keys:
---> 75 collaboration = items.pop(-1)['collaboration']
76 else:
77 collaboration = {'ce:indexed-name': None}
KeyError: 'collaboration'
I am using another package 'litstudy' which depends on pybliometrics.
Can you help me find the issue? it seems to revolve around the author group.
@silas-blomqvist: sorry, it seems I missed your request! If your problem is still present, please provide more information (ideally in a new issue): Code to reproduce as well as the pybliometrics version you're using.
Bug report? Please state your pybliometrics version and a complete code snippet to reproduce the bug.
Version: 3.2.0 (latest available on PyPi)
AbstractRetrieval
fails with publications that include collaboration as@auid
is not set when accessing theauthorgroup
property.Traceback:
The collaboration metadata from the Scopus response is: