EmmaScharfmannBerkeley commited on
Commit
83e1499
·
1 Parent(s): f7fa719

Update Climate_site/python_scripts/paper_functions_own_details.py

Browse files
Climate_site/python_scripts/paper_functions_own_details.py CHANGED
@@ -434,7 +434,6 @@ def main_authors( research_key_words , details , size):
434
  dic_papers , dic_papers_ranked = ranking_own_research( research_key_words , details , False )
435
 
436
  dic_papers_co_authors = {}
437
- dic_papers_map = {}
438
 
439
  for paper in list(dic_papers_ranked.keys()):
440
 
@@ -455,10 +454,10 @@ def main_authors( research_key_words , details , size):
455
  dic_papers_co_authors[author_name_norm]["Author's id(s)"] = coauthor_id[21:]
456
  else:
457
  dic_papers_co_authors[author_name_norm]["Author's id(s)"] = ""
458
- dic_papers_co_authors[author_name_norm]["Number of occurence within the " + str(size) + " most related papers"] = 1
459
  dic_papers_co_authors[author_name_norm]["Number of related citations"] = dic_papers[paper]["cited_by_count"]
460
  else:
461
- dic_papers_co_authors[author_name_norm]["Number of occurence within the " + str(size) + " most related papers"] += 1
462
  if author_name not in dic_papers_co_authors[author_name_norm]["Author's name(s)"]:
463
  dic_papers_co_authors[author_name_norm]["Author's name(s)"] += ", " + author_name
464
  if coauthor_id != None and coauthor_id[21:] not in dic_papers_co_authors[author_name_norm]["Author's id(s)"]:
@@ -499,11 +498,39 @@ def main_authors( research_key_words , details , size):
499
  dic_papers_co_authors[author_name_norm]["Number of citations"] = cited_by_count
500
  dic_papers_co_authors[author_name_norm]["Institution_id"] = institution_id
501
 
 
502
 
503
  dic_papers_co_authors = {k: v for k, v in sorted(dic_papers_co_authors.items(), key=lambda item: item[1]["Number of occurence within the " + str(200) + " most related papers"] , reverse = True)[:size]}
504
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
505
 
506
- return pd.DataFrame(dic_papers_co_authors, index = [ "Author's name(s)" , "Author's id(s)" , "Number of occurence within the " + str(200) + " most related papers" , "Last Known Institution" , "Number of works" , "Number of citations" , "Number of related citations"]).T.style.hide(axis="index")
 
 
 
 
 
 
 
 
 
 
 
507
 
508
  else:
509
  return ("Select another category")
 
434
  dic_papers , dic_papers_ranked = ranking_own_research( research_key_words , details , False )
435
 
436
  dic_papers_co_authors = {}
 
437
 
438
  for paper in list(dic_papers_ranked.keys()):
439
 
 
454
  dic_papers_co_authors[author_name_norm]["Author's id(s)"] = coauthor_id[21:]
455
  else:
456
  dic_papers_co_authors[author_name_norm]["Author's id(s)"] = ""
457
+ dic_papers_co_authors[author_name_norm]["Number of occurence within the " + str(200) + " most related papers"] = 1
458
  dic_papers_co_authors[author_name_norm]["Number of related citations"] = dic_papers[paper]["cited_by_count"]
459
  else:
460
+ dic_papers_co_authors[author_name_norm]["Number of occurence within the " + str(200) + " most related papers"] += 1
461
  if author_name not in dic_papers_co_authors[author_name_norm]["Author's name(s)"]:
462
  dic_papers_co_authors[author_name_norm]["Author's name(s)"] += ", " + author_name
463
  if coauthor_id != None and coauthor_id[21:] not in dic_papers_co_authors[author_name_norm]["Author's id(s)"]:
 
498
  dic_papers_co_authors[author_name_norm]["Number of citations"] = cited_by_count
499
  dic_papers_co_authors[author_name_norm]["Institution_id"] = institution_id
500
 
501
+
502
 
503
  dic_papers_co_authors = {k: v for k, v in sorted(dic_papers_co_authors.items(), key=lambda item: item[1]["Number of occurence within the " + str(200) + " most related papers"] , reverse = True)[:size]}
504
 
505
+
506
+ dic_papers_map = {}
507
+ count = 0
508
+
509
+
510
+ for author_name_norm in dic_papers_co_authors:
511
+
512
+ institution_id = dic_papers_co_authors[author_name_norm]["Institution_id"]
513
+ if institution_id in dic_institutions:
514
+ dic_papers_map[count] = {}
515
+ dic_papers_map[count]["longitude"] = data["longitude"]
516
+ dic_papers_map[count]["latitude"] = data["latitude"]
517
+ dic_papers_map[count]["author"] = dic_papers_co_authors[author_name_norm]["Author's name(s)"]
518
+ dic_papers_map[count]["institution"] = dic_papers_co_authors[author_name_norm]["Last Known Institution"]
519
+
520
+ count += 1
521
 
522
+
523
+
524
+
525
+ map_df = pd.DataFrame(dic_papers_map).T
526
+
527
+ map_df["longitude"]=map_df['longitude'].astype(float)
528
+ map_df['latitude']=map_df['latitude'].astype(float)
529
+ map_df = map_df[map_df["latitude"].notnull()]
530
+
531
+
532
+
533
+ return pd.DataFrame(dic_papers_co_authors, index = [ "Author's name(s)" , "Author's id(s)" , "Number of occurence within the " + str(200) + " most related papers" , "Last Known Institution" , "Number of works" , "Number of citations" , "Number of related citations"]).T.style.hide(axis="index") , map_df
534
 
535
  else:
536
  return ("Select another category")