Skip to content

Commit 30f5cdb

Browse files
committed
Add analysis of PR lifetime vs. num participants. (#3)
1 parent 0a6ecff commit 30f5cdb

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

site/numpy_timeseries.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,9 +369,26 @@ fig.tight_layout();
369369

370370
### Number of PR participants
371371

372+
% TODO: Similar analysis, but replace num participants with some metrics of
373+
% how "big" the PR is; num LOC changed, etc.
374+
372375
```{code-cell} ipython3
373376
---
374377
tags: [hide-input]
375378
---
379+
# Get the lifetimes and number of participants for merged PRs
380+
lifetimes = np.array(
381+
[isoparse(pr["mergedAt"]) - isoparse(pr["createdAt"]) for pr in merged_prs],
382+
dtype="m8[h]",
383+
)
384+
num_participants = np.array([pr["participants"]["totalCount"] for pr in merged_prs])
376385
386+
title = "Distribution of lifetimes for merged PRs based on the number of participants"
377387
388+
p = figure(width=600, height=300, title=title)
389+
p.xgrid.grid_line_color = None
390+
p.xaxis.ticker = sorted(np.unique(num_participants))
391+
p.yaxis.axis_label = "PR lifetime (hours)"
392+
p.scatter(x=num_participants, y=lifetimes.astype(int), size=9, alpha=0.4)
393+
show(p)
394+
```

0 commit comments

Comments
 (0)