Skip to content

Commit 667b74e

Browse files
committed
Strip timezone offset to avoid NumPy warning
1 parent 91ffd48 commit 667b74e

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

devstats/reports/issue_time_to_response.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ tags: [hide-input]
77
# Remove issues that are less than a day old for the following analysis
88
newly_created_day_old = [
99
iss for iss in newly_created
10-
if np.datetime64(datetime.datetime.now()) - np.datetime64(iss["createdAt"])
11-
> np.timedelta64(1, "D")
10+
if (np.datetime64(datetime.datetime.now())
11+
- np.datetime64(iss["createdAt"].rstrip("Z"))) > np.timedelta64(1, "D")
1212
]
1313
1414
# TODO: really need pandas here
@@ -28,7 +28,8 @@ for iss in commented_issues:
2828
# This can happen e.g. when a user deletes their GH acct
2929
user = "UNKNOWN"
3030
first_commenters.append(user)
31-
dt = np.datetime64(e["node"]["createdAt"]) - np.datetime64(iss["createdAt"])
31+
dt = (np.datetime64(e["node"]["createdAt"]).rstrip("Z")
32+
- np.datetime64(iss["createdAt"]).rstrip("Z"))
3233
time_to_first_comment.append(dt.astype("m8[m]"))
3334
break # Only want the first commenter
3435
time_to_first_comment = np.array(time_to_first_comment) # in minutes

devstats/reports/new_issues.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@ tags: [hide-input]
88
---
99
1010
newly_created = [
11-
iss for iss in issues if np.datetime64(iss["createdAt"]) > query_date
11+
iss for iss in issues if np.datetime64(iss["createdAt"].rstrip("Z")) > query_date
1212
]
1313
new_issues_closed = [iss for iss in newly_created if iss["state"] == "CLOSED"]
1414
1515
new_issue_lifetime = np.array(
1616
[
17-
np.datetime64(iss["closedAt"]) - np.datetime64(iss["createdAt"])
17+
(np.datetime64(iss["closedAt"].rstrip("Z"))
18+
- np.datetime64(iss["createdAt"].rstrip("Z")))
1819
for iss in new_issues_closed
1920
],
2021
).astype("m8[h]") # in hours

0 commit comments

Comments
 (0)