Skip to content

Commit

Permalink
merge dev
Browse files Browse the repository at this point in the history
Signed-off-by: James Kunstle <[email protected]>
  • Loading branch information
JamesKunstle committed Feb 13, 2024
1 parent ed7c5d0 commit 7dec311
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
3 changes: 1 addition & 2 deletions 8Knot/pages/contributions/visualizations/issues_over_time.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions 8Knot/pages/contributions/visualizations/pr_over_time.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,20 +165,20 @@ 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
df_created["Date"] = pd.to_datetime(df_created["Date"].astype(str).str[:period_slice])

# 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
Expand Down
11 changes: 1 addition & 10 deletions 8Knot/pages/contributors/visualizations/new_contributor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 7dec311

Please sign in to comment.