Skip to content

Commit

Permalink
Remove authors with 0 commits from author of the year/month
Browse files Browse the repository at this point in the history
Fixes #215
  • Loading branch information
pulkomandy authored and vifactor committed May 31, 2023
1 parent fd4ebeb commit c000fde
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions analysis/gitrepository.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def get_authors_ranking_by_year(self):
# then sort each group
res = ts_agg.apply(lambda x: x.sort_values(ascending=False))

return res
return res[res > 0]

def get_authors_ranking_by_month(self):
"""
Expand All @@ -207,11 +207,12 @@ def get_authors_ranking_by_month(self):
.dt.strftime('%Y-%m')})

# https://stackoverflow.com/questions/27842613/pandas-groupby-sort-within-groups
ts_agg = df.groupby([df.timestamp, df.author_name]).size()\
.groupby(level=0, group_keys=False)
ts_agg = df.groupby([df.timestamp, df.author_name]).size()
ts_agg = ts_agg.groupby(level=0, group_keys=False)

# sort each group by value
return ts_agg.apply(lambda x: x.sort_values(ascending=False))
res = ts_agg.apply(lambda x: x.sort_values(ascending=False))
return res[res > 0]

@property
def authors(self) -> GitAuthors:
Expand Down

0 comments on commit c000fde

Please sign in to comment.