Skip to content

Commit

Permalink
Fix issue #30
Browse files Browse the repository at this point in the history
- Clip reference year to current year when calculating cit/year to avoid zero division in cit/year
  • Loading branch information
WittmannF committed Nov 15, 2023
1 parent fa67ad8 commit 05dc8b7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sortgs.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,8 @@ def main():
columns=['Author', 'Title', 'Citations', 'Year', 'Publisher', 'Venue', 'Source'])
data.index.name = 'Rank'

# Add columns with number of citations per year
data['cit/year']=data['Citations']/(end_year + 1 - data['Year'])
# Avoid years that are higher than the current year by clipping it to end_year
data['cit/year']=data['Citations']/(end_year + 1 - data['Year'].clip(upper=end_year))
data['cit/year']=data['cit/year'].round(0).astype(int)

# Sort by the selected columns, if exists
Expand Down

0 comments on commit 05dc8b7

Please sign in to comment.