From 32b63a510bc8fcc3eb79094d4a3f4bd05b51e955 Mon Sep 17 00:00:00 2001 From: Matthieu Schaller <schaller@strw.leidenuniv.nl> Date: Fri, 15 Dec 2023 09:21:53 +0100 Subject: [PATCH] Fix for 'nan' in the abstract --- query.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/query.py b/query.py index 3b54b98..e00b742 100644 --- a/query.py +++ b/query.py @@ -1,11 +1,12 @@ from myads.query import ADSQueryWrapper import yaml import sys +import math # Query papers citing the two SWIFT ADS entries query = ADSQueryWrapper(sys.argv[1]) query_data = query.get("citations(2016pasc.conf....2S) or citations(2018ascl.soft05020S) or citations(2023arXiv230513380S)", fl="title,bibcode,first_author_norm,date,year,author_count,bibstem,abstract,volume,issue,page,citation_count", rows=1000) -paper_list = query_data.papers +paper_list = list(query_data.papers) total_citations = 0 # Process the data to make the title a string and not an array of strings @@ -17,10 +18,11 @@ for paper in paper_list: if len(paper.title) == 1: paper.title = paper.title[0] paper.bibstem = paper.bibstem[0] - if hasattr(paper, "page"): + if hasattr(paper, "page") and "PhDT" not in paper.bibcode: paper.page = paper.page[0] if hasattr(paper, "abstract"): - paper.abstract = paper.abstract.replace("<P />", "") + if not isinstance(paper.abstract, float): + paper.abstract = paper.abstract.replace("<P />", "") total_citations += paper.citation_count paper_list.remove(to_remove) -- GitLab