{"action":"created","comment":{"url":"https://api.github.com/repos/quantopian/zipline/pulls/comments/75378667","id":75378667,"diff_hunk":"@@ -684,17 +685,22 @@ def minute_to_session_label(self, dt, direction=\"next\"):\n             The label of the containing session.\n         \"\"\"\n \n-        idx = searchsorted(self.market_closes_nanos, dt.value)\n+        if type(dt) is pd.Timestamp:","path":"zipline/utils/calendars/trading_calendar.py","position":null,"original_position":24,"commit_id":"c992d9537ccd3f3731cf40c813894d0d6c293281","original_commit_id":"94eeb0a9785c33efe1be68e49040fa882bb6d8c3","user":{"login":"richafrank","id":2123660,"avatar_url":"https://avatars.githubusercontent.com/u/2123660?v=3","gravatar_id":"","url":"https://api.github.com/users/richafrank","html_url":"https://github.com/richafrank","followers_url":"https://api.github.com/users/richafrank/followers","following_url":"https://api.github.com/users/richafrank/following{/other_user}","gists_url":"https://api.github.com/users/richafrank/gists{/gist_id}","starred_url":"https://api.github.com/users/richafrank/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/richafrank/subscriptions","organizations_url":"https://api.github.com/users/richafrank/orgs","repos_url":"https://api.github.com/users/richafrank/repos","events_url":"https://api.github.com/users/richafrank/events{/privacy}","received_events_url":"https://api.github.com/users/richafrank/received_events","type":"User","site_admin":false},"body":"Yea, I recommend `isinstance` one way or the other.  Then it's more flexible with subclasses.  \r\n\r\nTake a look at the `coerce` preprocessor - it uses `isinstance` [internally] (https://github.com/quantopian/zipline/blob/bfa3e6f153698df8dd04334012aeacde9f3912c9/zipline/utils/input_validation.py#L575-L575) to decide whether to run the coercion function or pass through the original arg.","created_at":"2016-08-18T20:02:25Z","updated_at":"2016-08-18T20:02:25Z","html_url":"https://github.com/quantopian/zipline/pull/1407#discussion_r75378667","pull_request_url":"https://api.github.com/repos/quantopian/zipline/pulls/1407","_links":{"self":{"href":"https://api.github.com/repos/quantopian/zipline/pulls/comments/75378667"},"html":{"href":"https://github.com/quantopian/zipline/pull/1407#discussion_r75378667"},"pull_request":{"href":"https://api.github.com/repos/quantopian/zipline/pulls/1407"}}},"pull_request":{"url":"https://api.github.com/repos/quantopian/zipline/pulls/1407","id":81720129,"html_url":"https://github.com/quantopian/zipline/pull/1407","diff_url":"https://github.com/quantopian/zipline/pull/1407.diff","patch_url":"https://github.com/quantopian/zipline/pull/1407.patch","issue_url":"https://api.github.com/repos/quantopian/zipline/issues/1407","number":1407,"state":"open","locked":false,"title":"ENH: Add fast \"vectorized\" `minute_to_session_label` for DatetimeIndex","user":{"login":"nathanwolfe","id":6825446,"avatar_url":"https://avatars.githubusercontent.com/u/6825446?v=3","gravatar_id":"","url":"https://api.github.com/users/nathanwolfe","html_url":"https://github.com/nathanwolfe","followers_url":"https://api.github.com/users/nathanwolfe/followers","following_url":"https://api.github.com/users/nathanwolfe/following{/other_user}","gists_url":"https://api.github.com/users/nathanwolfe/gists{/gist_id}","starred_url":"https://api.github.com/users/nathanwolfe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nathanwolfe/subscriptions","organizations_url":"https://api.github.com/users/nathanwolfe/orgs","repos_url":"https://api.github.com/users/nathanwolfe/repos","events_url":"https://api.github.com/users/nathanwolfe/events{/privacy}","received_events_url":"https://api.github.com/users/nathanwolfe/received_events","type":"User","site_admin":false},"body":"~~*Incomplete; \"vectorized\" `minute_to_session_label` is done so far*~~\r\n\r\nThe new TradingCalendar method is called `minute_index_to_session_labels`.\r\nIt takes a DatetimeIndex of in-order market minutes and returns a\r\nDatetimeIndex of the corresponding sessions.\r\n\r\nThe new method is approximately 100x faster than mapping\r\n`minute_to_session_label` over a large DatetimeIndex.","created_at":"2016-08-17T21:28:55Z","updated_at":"2016-08-18T20:02:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"caf28b161d0366c828dad0a3e15dfae1b5e52301","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/quantopian/zipline/pulls/1407/commits","review_comments_url":"https://api.github.com/repos/quantopian/zipline/pulls/1407/comments","review_comment_url":"https://api.github.com/repos/quantopian/zipline/pulls/comments{/number}","comments_url":"https://api.github.com/repos/quantopian/zipline/issues/1407/comments","statuses_url":"https://api.github.com/repos/quantopian/zipline/statuses/c992d9537ccd3f3731cf40c813894d0d6c293281","head":{"label":"quantopian:minute_panel_daily_history","ref":"minute_panel_daily_history","sha":"c992d9537ccd3f3731cf40c813894d0d6c293281","user":{"login":"quantopian","id":1393215,"avatar_url":"https://avatars.githubusercontent.com/u/1393215?v=3","gravatar_id":"","url":"https://api.github.com/users/quantopian","html_url":"https://github.com/quantopian","followers_url":"https://api.github.com/users/quantopian/followers","following_url":"https://api.github.com/users/quantopian/following{/other_user}","gists_url":"https://api.github.com/users/quantopian/gists{/gist_id}","starred_url":"https://api.github.com/users/quantopian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/quantopian/subscriptions","organizations_url":"https://api.github.com/users/quantopian/orgs","repos_url":"https://api.github.com/users/quantopian/repos","events_url":"https://api.github.com/users/quantopian/events{/privacy}","received_events_url":"https://api.github.com/users/quantopian/received_events","type":"Organization","site_admin":false},"repo":{"id":6297520,"name":"zipline","full_name":"quantopian/zipline","owner":{"login":"quantopian","id":1393215,"avatar_url":"https://avatars.githubusercontent.com/u/1393215?v=3","gravatar_id":"","url":"https://api.github.com/users/quantopian","html_url":"https://github.com/quantopian","followers_url":"https://api.github.com/users/quantopian/followers","following_url":"https://api.github.com/users/quantopian/following{/other_user}","gists_url":"https://api.github.com/users/quantopian/gists{/gist_id}","starred_url":"https://api.github.com/users/quantopian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/quantopian/subscriptions","organizations_url":"https://api.github.com/users/quantopian/orgs","repos_url":"https://api.github.com/users/quantopian/repos","events_url":"https://api.github.com/users/quantopian/events{/privacy}","received_events_url":"https://api.github.com/users/quantopian/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/quantopian/zipline","description":"Zipline, a Pythonic Algorithmic Trading Library","fork":false,"url":"https://api.github.com/repos/quantopian/zipline","forks_url":"https://api.github.com/repos/quantopian/zipline/forks","keys_url":"https://api.github.com/repos/quantopian/zipline/keys{/key_id}","collaborators_url":"https://api.github.com/repos/quantopian/zipline/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/quantopian/zipline/teams","hooks_url":"https://api.github.com/repos/quantopian/zipline/hooks","issue_events_url":"https://api.github.com/repos/quantopian/zipline/issues/events{/number}","events_url":"https://api.github.com/repos/quantopian/zipline/events","assignees_url":"https://api.github.com/repos/quantopian/zipline/assignees{/user}","branches_url":"https://api.github.com/repos/quantopian/zipline/branches{/branch}","tags_url":"https://api.github.com/repos/quantopian/zipline/tags","blobs_url":"https://api.github.com/repos/quantopian/zipline/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/quantopian/zipline/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/quantopian/zipline/git/refs{/sha}","trees_url":"https://api.github.com/repos/quantopian/zipline/git/trees{/sha}","statuses_url":"https://api.github.com/repos/quantopian/zipline/statuses/{sha}","languages_url":"https://api.github.com/repos/quantopian/zipline/languages","stargazers_url":"https://api.github.com/repos/quantopian/zipline/stargazers","contributors_url":"https://api.github.com/repos/quantopian/zipline/contributors","subscribers_url":"https://api.github.com/repos/quantopian/zipline/subscribers","subscription_url":"https://api.github.com/repos/quantopian/zipline/subscription","commits_url":"https://api.github.com/repos/quantopian/zipline/commits{/sha}","git_commits_url":"https://api.github.com/repos/quantopian/zipline/git/commits{/sha}","comments_url":"https://api.github.com/repos/quantopian/zipline/comments{/number}","issue_comment_url":"https://api.github.com/repos/quantopian/zipline/issues/comments{/number}","contents_url":"https://api.github.com/repos/quantopian/zipline/contents/{+path}","compare_url":"https://api.github.com/repos/quantopian/zipline/compare/{base}...{head}","merges_url":"https://api.github.com/repos/quantopian/zipline/merges","archive_url":"https://api.github.com/repos/quantopian/zipline/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/quantopian/zipline/downloads","issues_url":"https://api.github.com/repos/quantopian/zipline/issues{/number}","pulls_url":"https://api.github.com/repos/quantopian/zipline/pulls{/number}","milestones_url":"https://api.github.com/repos/quantopian/zipline/milestones{/number}","notifications_url":"https://api.github.com/repos/quantopian/zipline/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/quantopian/zipline/labels{/name}","releases_url":"https://api.github.com/repos/quantopian/zipline/releases{/id}","deployments_url":"https://api.github.com/repos/quantopian/zipline/deployments","created_at":"2012-10-19T15:50:29Z","updated_at":"2016-08-18T14:53:46Z","pushed_at":"2016-08-18T19:56:11Z","git_url":"git://github.com/quantopian/zipline.git","ssh_url":"git@github.com:quantopian/zipline.git","clone_url":"https://github.com/quantopian/zipline.git","svn_url":"https://github.com/quantopian/zipline","homepage":"","size":134066,"stargazers_count":3607,"watchers_count":3607,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1114,"mirror_url":null,"open_issues_count":163,"forks":1114,"open_issues":163,"watchers":3607,"default_branch":"master"}},"base":{"label":"quantopian:master","ref":"master","sha":"37e6a48e99ea70d97f8a87e0b570e05d2f61a48d","user":{"login":"quantopian","id":1393215,"avatar_url":"https://avatars.githubusercontent.com/u/1393215?v=3","gravatar_id":"","url":"https://api.github.com/users/quantopian","html_url":"https://github.com/quantopian","followers_url":"https://api.github.com/users/quantopian/followers","following_url":"https://api.github.com/users/quantopian/following{/other_user}","gists_url":"https://api.github.com/users/quantopian/gists{/gist_id}","starred_url":"https://api.github.com/users/quantopian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/quantopian/subscriptions","organizations_url":"https://api.github.com/users/quantopian/orgs","repos_url":"https://api.github.com/users/quantopian/repos","events_url":"https://api.github.com/users/quantopian/events{/privacy}","received_events_url":"https://api.github.com/users/quantopian/received_events","type":"Organization","site_admin":false},"repo":{"id":6297520,"name":"zipline","full_name":"quantopian/zipline","owner":{"login":"quantopian","id":1393215,"avatar_url":"https://avatars.githubusercontent.com/u/1393215?v=3","gravatar_id":"","url":"https://api.github.com/users/quantopian","html_url":"https://github.com/quantopian","followers_url":"https://api.github.com/users/quantopian/followers","following_url":"https://api.github.com/users/quantopian/following{/other_user}","gists_url":"https://api.github.com/users/quantopian/gists{/gist_id}","starred_url":"https://api.github.com/users/quantopian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/quantopian/subscriptions","organizations_url":"https://api.github.com/users/quantopian/orgs","repos_url":"https://api.github.com/users/quantopian/repos","events_url":"https://api.github.com/users/quantopian/events{/privacy}","received_events_url":"https://api.github.com/users/quantopian/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/quantopian/zipline","description":"Zipline, a Pythonic Algorithmic Trading Library","fork":false,"url":"https://api.github.com/repos/quantopian/zipline","forks_url":"https://api.github.com/repos/quantopian/zipline/forks","keys_url":"https://api.github.com/repos/quantopian/zipline/keys{/key_id}","collaborators_url":"https://api.github.com/repos/quantopian/zipline/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/quantopian/zipline/teams","hooks_url":"https://api.github.com/repos/quantopian/zipline/hooks","issue_events_url":"https://api.github.com/repos/quantopian/zipline/issues/events{/number}","events_url":"https://api.github.com/repos/quantopian/zipline/events","assignees_url":"https://api.github.com/repos/quantopian/zipline/assignees{/user}","branches_url":"https://api.github.com/repos/quantopian/zipline/branches{/branch}","tags_url":"https://api.github.com/repos/quantopian/zipline/tags","blobs_url":"https://api.github.com/repos/quantopian/zipline/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/quantopian/zipline/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/quantopian/zipline/git/refs{/sha}","trees_url":"https://api.github.com/repos/quantopian/zipline/git/trees{/sha}","statuses_url":"https://api.github.com/repos/quantopian/zipline/statuses/{sha}","languages_url":"https://api.github.com/repos/quantopian/zipline/languages","stargazers_url":"https://api.github.com/repos/quantopian/zipline/stargazers","contributors_url":"https://api.github.com/repos/quantopian/zipline/contributors","subscribers_url":"https://api.github.com/repos/quantopian/zipline/subscribers","subscription_url":"https://api.github.com/repos/quantopian/zipline/subscription","commits_url":"https://api.github.com/repos/quantopian/zipline/commits{/sha}","git_commits_url":"https://api.github.com/repos/quantopian/zipline/git/commits{/sha}","comments_url":"https://api.github.com/repos/quantopian/zipline/comments{/number}","issue_comment_url":"https://api.github.com/repos/quantopian/zipline/issues/comments{/number}","contents_url":"https://api.github.com/repos/quantopian/zipline/contents/{+path}","compare_url":"https://api.github.com/repos/quantopian/zipline/compare/{base}...{head}","merges_url":"https://api.github.com/repos/quantopian/zipline/merges","archive_url":"https://api.github.com/repos/quantopian/zipline/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/quantopian/zipline/downloads","issues_url":"https://api.github.com/repos/quantopian/zipline/issues{/number}","pulls_url":"https://api.github.com/repos/quantopian/zipline/pulls{/number}","milestones_url":"https://api.github.com/repos/quantopian/zipline/milestones{/number}","notifications_url":"https://api.github.com/repos/quantopian/zipline/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/quantopian/zipline/labels{/name}","releases_url":"https://api.github.com/repos/quantopian/zipline/releases{/id}","deployments_url":"https://api.github.com/repos/quantopian/zipline/deployments","created_at":"2012-10-19T15:50:29Z","updated_at":"2016-08-18T14:53:46Z","pushed_at":"2016-08-18T19:56:11Z","git_url":"git://github.com/quantopian/zipline.git","ssh_url":"git@github.com:quantopian/zipline.git","clone_url":"https://github.com/quantopian/zipline.git","svn_url":"https://github.com/quantopian/zipline","homepage":"","size":134066,"stargazers_count":3607,"watchers_count":3607,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1114,"mirror_url":null,"open_issues_count":163,"forks":1114,"open_issues":163,"watchers":3607,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/quantopian/zipline/pulls/1407"},"html":{"href":"https://github.com/quantopian/zipline/pull/1407"},"issue":{"href":"https://api.github.com/repos/quantopian/zipline/issues/1407"},"comments":{"href":"https://api.github.com/repos/quantopian/zipline/issues/1407/comments"},"review_comments":{"href":"https://api.github.com/repos/quantopian/zipline/pulls/1407/comments"},"review_comment":{"href":"https://api.github.com/repos/quantopian/zipline/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/quantopian/zipline/pulls/1407/commits"},"statuses":{"href":"https://api.github.com/repos/quantopian/zipline/statuses/c992d9537ccd3f3731cf40c813894d0d6c293281"}}}}
{"actor":{"display_login":"richafrank"}}