From 7dec31160b7e8470b03a9eae00f8660b625af65e Mon Sep 17 00:00:00 2001 From: James Kunstle Date: Tue, 6 Feb 2024 12:41:12 -0500 Subject: [PATCH] merge dev Signed-off-by: James Kunstle --- .../visualizations/cntrb_pr_assignment.py | 7 +------ .../visualizations/cntrib_issue_assignment.py | 7 +------ .../contributions/visualizations/issues_over_time.py | 3 +-- .../contributions/visualizations/pr_over_time.py | 6 +++--- .../contributors/visualizations/new_contributor.py | 11 +---------- 5 files changed, 7 insertions(+), 27 deletions(-) diff --git a/8Knot/pages/contributions/visualizations/cntrb_pr_assignment.py b/8Knot/pages/contributions/visualizations/cntrb_pr_assignment.py index 73633c71..b3907a07 100644 --- a/8Knot/pages/contributions/visualizations/cntrb_pr_assignment.py +++ b/8Knot/pages/contributions/visualizations/cntrb_pr_assignment.py @@ -217,12 +217,7 @@ def process_data(df: pd.DataFrame, interval, assign_req, start_date, end_date): df_contrib = df[df["assignment_action"] == "assigned"] # count the assignments total for each contributor - df_contrib = ( - df_contrib["assignee"] - .value_counts() - .to_frame() - .reset_index() - ) + df_contrib = df_contrib["assignee"].value_counts().to_frame().reset_index() # create list of all contributors that meet the assignment requirement contributors = df_contrib["assignee"][df_contrib["count"] >= assign_req].to_list() diff --git a/8Knot/pages/contributions/visualizations/cntrib_issue_assignment.py b/8Knot/pages/contributions/visualizations/cntrib_issue_assignment.py index 3ba6cb07..0d5ff9e3 100644 --- a/8Knot/pages/contributions/visualizations/cntrib_issue_assignment.py +++ b/8Knot/pages/contributions/visualizations/cntrib_issue_assignment.py @@ -214,12 +214,7 @@ def process_data(df: pd.DataFrame, interval, assign_req, start_date, end_date): df_contrib = df[df["assignment_action"] == "assigned"] # count the assignments total for each contributor - df_contrib = ( - df_contrib["assignee"] - .value_counts() - .to_frame() - .reset_index() - ) + df_contrib = df_contrib["assignee"].value_counts().to_frame().reset_index() # create list of all contributors that meet the assignment requirement contributors = df_contrib["assignee"][df_contrib["count"] >= assign_req].to_list() diff --git a/8Knot/pages/contributions/visualizations/issues_over_time.py b/8Knot/pages/contributions/visualizations/issues_over_time.py index 4dc4be45..18093b75 100644 --- a/8Knot/pages/contributions/visualizations/issues_over_time.py +++ b/8Knot/pages/contributions/visualizations/issues_over_time.py @@ -189,7 +189,7 @@ def process_data(df: pd.DataFrame, interval, start_date, end_date): created_range = pd.to_datetime(df["created_at"]).dt.to_period(interval).value_counts().sort_index() # converts to data frame object and creates date column from period values - df_created = created_range.to_frame().reset_index().rename(columns={"created": "Date", "count": "created"}) + df_created = created_range.to_frame().reset_index().rename(columns={"created_at": "Date", "count": "created_at"}) # converts date column to a datetime object, converts to string first to handle period information # the period slice is to handle weekly corner case @@ -199,7 +199,6 @@ def process_data(df: pd.DataFrame, interval, start_date, end_date): closed_range = pd.to_datetime(df["closed_at"]).dt.to_period(interval).value_counts().sort_index() df_closed = closed_range.to_frame().reset_index().rename(columns={"closed_at": "Date", "count": "closed_at"}) - df_closed["Date"] = pd.to_datetime(df_closed["Date"].astype(str).str[:period_slice]) # first and last elements of the dataframe are the diff --git a/8Knot/pages/contributions/visualizations/pr_over_time.py b/8Knot/pages/contributions/visualizations/pr_over_time.py index 77232858..255b896a 100644 --- a/8Knot/pages/contributions/visualizations/pr_over_time.py +++ b/8Knot/pages/contributions/visualizations/pr_over_time.py @@ -165,7 +165,7 @@ def process_data(df: pd.DataFrame, interval): created_range = df["created_at"].dt.to_period(interval).value_counts().sort_index() # converts to data frame object and created date column from period values - df_created = created_range.to_frame().reset_index().rename(columns={"created": "Date", "count": "created"}) + df_created = created_range.to_frame().reset_index().rename(columns={"created_at": "Date", "count": "created_at"}) # converts date column to a datetime object, converts to string first to handle period information # the period slice is to handle weekly corner case @@ -173,12 +173,12 @@ def process_data(df: pd.DataFrame, interval): # df for merged prs in time interval merged_range = pd.to_datetime(df["merged_at"]).dt.to_period(interval).value_counts().sort_index() - df_merged = merged_range.to_frame().reset_index().rename(columns={"merged": "Date", "count": "merged"}) + df_merged = merged_range.to_frame().reset_index().rename(columns={"merged_at": "Date", "count": "merged_at"}) df_merged["Date"] = pd.to_datetime(df_merged["Date"].astype(str).str[:period_slice]) # df for closed prs in time interval closed_range = pd.to_datetime(df["closed_at"]).dt.to_period(interval).value_counts().sort_index() - df_closed = closed_range.to_frame().reset_index().rename(columns={"closed": "Date", "count": "closed"}) + df_closed = closed_range.to_frame().reset_index().rename(columns={"closed_at": "Date", "count": "closed_at"}) df_closed["Date"] = pd.to_datetime(df_closed["Date"].astype(str).str[:period_slice]) # A single df created for plotting merged and closed as stacked bar chart diff --git a/8Knot/pages/contributors/visualizations/new_contributor.py b/8Knot/pages/contributors/visualizations/new_contributor.py index a7f3fde8..cade7775 100644 --- a/8Knot/pages/contributors/visualizations/new_contributor.py +++ b/8Knot/pages/contributors/visualizations/new_contributor.py @@ -186,19 +186,10 @@ def process_data(df, interval): return df, None # get the count of new contributors in the desired interval in pandas period format, sort index to order entries -<<<<<<< HEAD created_range = pd.to_datetime(df["created_at"]).dt.to_period(interval).value_counts().sort_index() # converts to data frame object and creates date column from period values - df_contribs = created_range.to_frame().reset_index().rename(columns={"index": "Date", "created_at": "contribs"}) -======= - created_range = pd.to_datetime(df["created"]).dt.to_period(interval).value_counts().sort_index() - logging.critical(f"created_range new_contributor.py {created_range}") - - # converts to data frame object and creates date column from period values - df_contribs = created_range.to_frame().reset_index().rename(columns={"created": "Date", "count": "contribs"}) - logging.critical(f"df_contribs new_contributor.py {df_contribs}") ->>>>>>> 7d12c64 (fixes df names for contributors page) + df_contribs = created_range.to_frame().reset_index().rename(columns={"created_at": "Date", "count": "contribs"}) # converts date column to a datetime object, converts to string first to handle period information df_contribs["Date"] = pd.to_datetime(df_contribs["Date"].astype(str))