Skip to content

Instantly share code, notes, and snippets.

@oleiade
Last active August 29, 2015 14:27
Show Gist options
  • Save oleiade/d112d343373c199ecbc0 to your computer and use it in GitHub Desktop.
Save oleiade/d112d343373c199ecbc0 to your computer and use it in GitHub Desktop.
Grouping by state
State Passed Failed Errored Cancelled Started
FinishedAt
2014-07-06 43 23 5 5 5 5
2014-07-13 25 19 1 5 5 5
2014-07-20 141 99 9 27 27 27
2014-07-27 111 82 6 20 20 20
2014-08-03 140 96 19 18 18 18
2014-08-10 131 95 11 15 15 15
2014-08-17 123 87 19 13 13 13
2014-08-24 133 86 35 11 11 11
2014-08-31 160 77 65 17 17 17
2014-09-07 152 96 43 9 9 9
builds = builds = pd.DataFrame.from_csv(
"given.csv",
parse_dates=['StartedAt', 'FinishedAt'],
index_col=9
)
builds = builds.sort_index(ascending=True)
test = builds['State'].resample('W', how={'State': 'count'})
test['Passed'] = builds[builds['State'] == 'passed']['State'].resample('W', how={'State': 'count'})
test['Failed'] = builds[builds['State'] == 'failed']['State'].resample('W', how={'State': 'count'})
test['Errored'] = builds[builds['State'] == 'errored']['State'].resample('W', how={'State': 'count'})
test['Cancelled'] = builds[builds['State'] == 'errored']['State'].resample('W', how={'State': 'count'})
test['Started'] = builds[builds['State'] == 'errored']['State'].resample('W', how={'State': 'count'})
CI Id Repository RepositoryId CommitId Number IsPullRequest State StartedAt FinishedAt Duration
travis 1411208937 user/repo 943439 1234 108 true failed 2015-07-31T12:39:05Z 2015-07-31T12:39:11Z 6
travis 1124983045 user/repo 943439 56789 107 false failed 2015-07-31T12:38:53Z 2015-07-31T12:39:00Z 7
travis 1339501932 user/repo 943439 0987 106 true failed 2015-07-31T12:35:36Z 2015-07-31T12:35:43Z 7
travis 5209381847 user/repo 943439 23156 105 false failed 2015-07-31T12:35:36Z 2015-07-31T12:35:42Z 6
travis 5767904 user/repo 454114 7158239 6 false failed 2014-08-29T09:57:32Z 2014-08-29T10:00:57Z 656
travis 5767766 user/repo 454114 7158069 5 true failed 2014-08-29T09:49:54Z 2014-08-29T09:55:49Z 783
travis 5767474 user/repo 454114 7157712 4 false failed 2014-08-29T09:34:34Z 2014-08-29T09:37:35Z 669
travis 5767074 user/repo 454114 7157173 3 false errored 2014-08-29T09:11:12Z 2014-08-29T09:13:57Z 455
travis 5766914 user/repo 454114 7156969 2 false errored 2014-08-29T09:07:35Z 2014-08-29T09:10:49Z 597
travis 5766654 user/repo 454114 7156656 1 false errored 2014-08-29T08:51:03Z 2014-08-29T08:52:23Z 204
travis 13607962 user/repo 977428 18335752 2 false passed 2015-07-14T13:17:18Z 2015-07-14T13:19:04Z 113
travis 13605628 user/repo 977428 18332493 1 false passed 2015-07-14T12:02:40Z 2015-07-14T12:03:49Z 79
travis 13607927 user/repo 938364 18335709 2 false passed 2015-07-14T13:16:16Z 2015-07-14T13:17:41Z 95
travis 13607693 user/repo 938364 18335373 1 false passed 2015-07-14T13:10:01Z 2015-07-14T13:11:21Z 89
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment