diff --git a/Pipfile b/Pipfile index 1c3302e..2fbd8ab 100644 --- a/Pipfile +++ b/Pipfile @@ -4,13 +4,13 @@ verify_ssl = true name = "pypi" [packages] -pygit2 = ">=1.0.3" +pygit2 = ">=1.6.1" pytz = ">=2018.5" -pandas = "~=0.25.3" +pandas = ">=1.3.3" tqdm = "~=4.45.0" Jinja2 = ">=2.10.1" [dev-packages] [requires] -python_version = "3.8" +python_version = "3.6" diff --git a/analysis/gitauthors.py b/analysis/gitauthors.py index 0b8a058..0f00aca 100644 --- a/analysis/gitauthors.py +++ b/analysis/gitauthors.py @@ -9,9 +9,14 @@ def __init__(self, git_history: pd.DataFrame): 'deletions']].copy() self.raw_authors_data['author_datetime'] = pd.to_datetime(git_history['author_timestamp'], unit='s', utc=True) + # Convert is_merge_commit to int32 so it can be summed + self.raw_authors_data['is_merge_commit'] = self.raw_authors_data['is_merge_commit'].astype('int32') + authors_grouped = self.raw_authors_data[['author_name', 'author_datetime', 'insertions', 'deletions', 'is_merge_commit']].groupby( [self.raw_authors_data['author_name']]) + + self.authors_summary = authors_grouped.sum(numeric_only=True) self.authors_summary['first_commit_date'] = authors_grouped['author_datetime'].min() self.authors_summary['latest_commit_date'] = authors_grouped['author_datetime'].max() @@ -24,7 +29,6 @@ def __init__(self, git_history: pd.DataFrame): self.authors_summary['contributed_days_count'].replace(0, 1, inplace=True) self.authors_summary['commits_count'] = authors_grouped['author_name'].count() self.authors_summary.rename(columns={'is_merge_commit': 'merge_commits_count'}, inplace=True) - self.authors_summary['merge_commits_count'] = self.authors_summary['merge_commits_count'].astype('int32') self.authors_summary.reset_index(inplace=True) def count(self):