{"action":"created","comment":{"url":"https://api.github.com/repos/pandas-dev/pandas/pulls/comments/205755462","pull_request_review_id":141090209,"id":205755462,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwNTc1NTQ2Mg==","diff_hunk":"@@ -2145,6 +2128,32 @@ def get_values(self, dtype=None):\n                                  self._box_func).reshape(self.values.shape)\n         return self.values\n \n+    def _try_coerce_args(self, values, other):\n+        self._validate_tz(other)\n+\n+        if is_null_datelike_scalar(other):\n+            other = self.fill_value\n+        elif isinstance(other, (Timedelta, tslibs.Timestamp)):\n+            other = other.asm8\n+        elif isinstance(other, timedelta):\n+            other = np.timedelta64(other)\n+        elif isinstance(other, date):\n+            other = np.datetime64(other)\n+        elif isinstance(other, (np.timedelta64, np.datetime64, np.ndarray)):\n+            pass\n+        elif (hasattr(other, 'dtype')\n+              and (is_timedelta64_dtype(other) or is_datetime64_dtype(other))):\n+            other = getattr(other, 'values', other)\n+        else:\n+            # coercion issues\n+            # let higher levels handle\n+            raise TypeError\n+\n+        return values, other","path":"pandas/core/internals/blocks.py","position":168,"original_position":168,"commit_id":"98bd79a4501c1a87f68806980fa67c7eb1fc98b3","original_commit_id":"98bd79a4501c1a87f68806980fa67c7eb1fc98b3","user":{"login":"holymonson","id":902012,"node_id":"MDQ6VXNlcjkwMjAxMg==","avatar_url":"https://avatars1.githubusercontent.com/u/902012?v=4","gravatar_id":"","url":"https://api.github.com/users/holymonson","html_url":"https://github.com/holymonson","followers_url":"https://api.github.com/users/holymonson/followers","following_url":"https://api.github.com/users/holymonson/following{/other_user}","gists_url":"https://api.github.com/users/holymonson/gists{/gist_id}","starred_url":"https://api.github.com/users/holymonson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/holymonson/subscriptions","organizations_url":"https://api.github.com/users/holymonson/orgs","repos_url":"https://api.github.com/users/holymonson/repos","events_url":"https://api.github.com/users/holymonson/events{/privacy}","received_events_url":"https://api.github.com/users/holymonson/received_events","type":"User","site_admin":false},"body":"Seems `values` can be removed too. The other 2 `_try_coerce_args` overrides don't touch `values`, `_try_coerce_args` might rename to `_try_coerce_other`.","created_at":"2018-07-27T12:21:50Z","updated_at":"2018-07-27T12:21:50Z","html_url":"https://github.com/pandas-dev/pandas/pull/22063#discussion_r205755462","pull_request_url":"https://api.github.com/repos/pandas-dev/pandas/pulls/22063","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/pandas-dev/pandas/pulls/comments/205755462"},"html":{"href":"https://github.com/pandas-dev/pandas/pull/22063#discussion_r205755462"},"pull_request":{"href":"https://api.github.com/repos/pandas-dev/pandas/pulls/22063"}}},"pull_request":{"url":"https://api.github.com/repos/pandas-dev/pandas/pulls/22063","id":204091333,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA0MDkxMzMz","html_url":"https://github.com/pandas-dev/pandas/pull/22063","diff_url":"https://github.com/pandas-dev/pandas/pull/22063.diff","patch_url":"https://github.com/pandas-dev/pandas/pull/22063.patch","issue_url":"https://api.github.com/repos/pandas-dev/pandas/issues/22063","number":22063,"state":"open","locked":false,"title":"PROPOSAL: use datetime64 and timedelta64 to eval","user":{"login":"holymonson","id":902012,"node_id":"MDQ6VXNlcjkwMjAxMg==","avatar_url":"https://avatars1.githubusercontent.com/u/902012?v=4","gravatar_id":"","url":"https://api.github.com/users/holymonson","html_url":"https://github.com/holymonson","followers_url":"https://api.github.com/users/holymonson/followers","following_url":"https://api.github.com/users/holymonson/following{/other_user}","gists_url":"https://api.github.com/users/holymonson/gists{/gist_id}","starred_url":"https://api.github.com/users/holymonson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/holymonson/subscriptions","organizations_url":"https://api.github.com/users/holymonson/orgs","repos_url":"https://api.github.com/users/holymonson/repos","events_url":"https://api.github.com/users/holymonson/events{/privacy}","received_events_url":"https://api.github.com/users/holymonson/received_events","type":"User","site_admin":false},"body":"This PR aims to use datetime64 and timedelta64 in evaluation directly, instead of casting to integer and then casting back. \r\n\r\nBenefits:\r\n1. `values` is saved in `ndarray[datetime64]`, casting to `int` to eval is non-intuitive. It seems back to the time before numpy 1.7 which implements `datetime64`.\r\n2. `numpy.ufunc` can handle all the `dtype` change, e.g.  `datetime64 - datetime64 = timedelta64`. Additonally, nonsense operations are prohibited, e.g. `datetime64 + datetime64`.\r\n3. numpy implements `datetime64('NaT')`, seems `values_mask` and `other_mask` are no longer needed for `nan`s.\r\n4. `Series` can share the same call path with `DataFrame` in `Block`. Now `Series` is using `dispatch_to_index_op` to wrap as `Index`, but `Index` is 1d-array while `DataFrame` is 2d-array, so `DataFrame` can't use the same wrapper. `ndarray([Index])` is `dtype='O'` so can't be benefited from `numpy.ufunc`.\r\n\r\nThis commit has passed `tests/{internals,frame,dtypes}` , but not `tests/series`, because `dispatch_to_index_op` breaks it.","created_at":"2018-07-26T10:06:33Z","updated_at":"2018-07-27T12:21:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6b513a01ac430e71b54e5f2ed3058c6b0b1d3240","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/pandas-dev/pandas/pulls/22063/commits","review_comments_url":"https://api.github.com/repos/pandas-dev/pandas/pulls/22063/comments","review_comment_url":"https://api.github.com/repos/pandas-dev/pandas/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pandas-dev/pandas/issues/22063/comments","statuses_url":"https://api.github.com/repos/pandas-dev/pandas/statuses/98bd79a4501c1a87f68806980fa67c7eb1fc98b3","head":{"label":"holymonson:use_datetime64","ref":"use_datetime64","sha":"98bd79a4501c1a87f68806980fa67c7eb1fc98b3","user":{"login":"holymonson","id":902012,"node_id":"MDQ6VXNlcjkwMjAxMg==","avatar_url":"https://avatars1.githubusercontent.com/u/902012?v=4","gravatar_id":"","url":"https://api.github.com/users/holymonson","html_url":"https://github.com/holymonson","followers_url":"https://api.github.com/users/holymonson/followers","following_url":"https://api.github.com/users/holymonson/following{/other_user}","gists_url":"https://api.github.com/users/holymonson/gists{/gist_id}","starred_url":"https://api.github.com/users/holymonson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/holymonson/subscriptions","organizations_url":"https://api.github.com/users/holymonson/orgs","repos_url":"https://api.github.com/users/holymonson/repos","events_url":"https://api.github.com/users/holymonson/events{/privacy}","received_events_url":"https://api.github.com/users/holymonson/received_events","type":"User","site_admin":false},"repo":{"id":141678721,"node_id":"MDEwOlJlcG9zaXRvcnkxNDE2Nzg3MjE=","name":"pandas","full_name":"holymonson/pandas","owner":{"login":"holymonson","id":902012,"node_id":"MDQ6VXNlcjkwMjAxMg==","avatar_url":"https://avatars1.githubusercontent.com/u/902012?v=4","gravatar_id":"","url":"https://api.github.com/users/holymonson","html_url":"https://github.com/holymonson","followers_url":"https://api.github.com/users/holymonson/followers","following_url":"https://api.github.com/users/holymonson/following{/other_user}","gists_url":"https://api.github.com/users/holymonson/gists{/gist_id}","starred_url":"https://api.github.com/users/holymonson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/holymonson/subscriptions","organizations_url":"https://api.github.com/users/holymonson/orgs","repos_url":"https://api.github.com/users/holymonson/repos","events_url":"https://api.github.com/users/holymonson/events{/privacy}","received_events_url":"https://api.github.com/users/holymonson/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/holymonson/pandas","description":"Flexible and powerful data analysis / manipulation library for Python, providing labeled data structures similar to R data.frame objects, statistical functions, and much more","fork":true,"url":"https://api.github.com/repos/holymonson/pandas","forks_url":"https://api.github.com/repos/holymonson/pandas/forks","keys_url":"https://api.github.com/repos/holymonson/pandas/keys{/key_id}","collaborators_url":"https://api.github.com/repos/holymonson/pandas/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/holymonson/pandas/teams","hooks_url":"https://api.github.com/repos/holymonson/pandas/hooks","issue_events_url":"https://api.github.com/repos/holymonson/pandas/issues/events{/number}","events_url":"https://api.github.com/repos/holymonson/pandas/events","assignees_url":"https://api.github.com/repos/holymonson/pandas/assignees{/user}","branches_url":"https://api.github.com/repos/holymonson/pandas/branches{/branch}","tags_url":"https://api.github.com/repos/holymonson/pandas/tags","blobs_url":"https://api.github.com/repos/holymonson/pandas/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/holymonson/pandas/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/holymonson/pandas/git/refs{/sha}","trees_url":"https://api.github.com/repos/holymonson/pandas/git/trees{/sha}","statuses_url":"https://api.github.com/repos/holymonson/pandas/statuses/{sha}","languages_url":"https://api.github.com/repos/holymonson/pandas/languages","stargazers_url":"https://api.github.com/repos/holymonson/pandas/stargazers","contributors_url":"https://api.github.com/repos/holymonson/pandas/contributors","subscribers_url":"https://api.github.com/repos/holymonson/pandas/subscribers","subscription_url":"https://api.github.com/repos/holymonson/pandas/subscription","commits_url":"https://api.github.com/repos/holymonson/pandas/commits{/sha}","git_commits_url":"https://api.github.com/repos/holymonson/pandas/git/commits{/sha}","comments_url":"https://api.github.com/repos/holymonson/pandas/comments{/number}","issue_comment_url":"https://api.github.com/repos/holymonson/pandas/issues/comments{/number}","contents_url":"https://api.github.com/repos/holymonson/pandas/contents/{+path}","compare_url":"https://api.github.com/repos/holymonson/pandas/compare/{base}...{head}","merges_url":"https://api.github.com/repos/holymonson/pandas/merges","archive_url":"https://api.github.com/repos/holymonson/pandas/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/holymonson/pandas/downloads","issues_url":"https://api.github.com/repos/holymonson/pandas/issues{/number}","pulls_url":"https://api.github.com/repos/holymonson/pandas/pulls{/number}","milestones_url":"https://api.github.com/repos/holymonson/pandas/milestones{/number}","notifications_url":"https://api.github.com/repos/holymonson/pandas/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/holymonson/pandas/labels{/name}","releases_url":"https://api.github.com/repos/holymonson/pandas/releases{/id}","deployments_url":"https://api.github.com/repos/holymonson/pandas/deployments","created_at":"2018-07-20T07:26:55Z","updated_at":"2018-07-20T07:27:02Z","pushed_at":"2018-07-27T08:15:35Z","git_url":"git://github.com/holymonson/pandas.git","ssh_url":"git@github.com:holymonson/pandas.git","clone_url":"https://github.com/holymonson/pandas.git","svn_url":"https://github.com/holymonson/pandas","homepage":"http://pandas.pydata.org","size":128037,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"bsd-3-clause","name":"BSD 3-Clause \"New\" or \"Revised\" License","spdx_id":"BSD-3-Clause","url":"https://api.github.com/licenses/bsd-3-clause","node_id":"MDc6TGljZW5zZTU="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"pandas-dev:master","ref":"master","sha":"7a2fbce899aad302891ff9a95aeb1bd55efe533a","user":{"login":"pandas-dev","id":21206976,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIxMjA2OTc2","avatar_url":"https://avatars2.githubusercontent.com/u/21206976?v=4","gravatar_id":"","url":"https://api.github.com/users/pandas-dev","html_url":"https://github.com/pandas-dev","followers_url":"https://api.github.com/users/pandas-dev/followers","following_url":"https://api.github.com/users/pandas-dev/following{/other_user}","gists_url":"https://api.github.com/users/pandas-dev/gists{/gist_id}","starred_url":"https://api.github.com/users/pandas-dev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pandas-dev/subscriptions","organizations_url":"https://api.github.com/users/pandas-dev/orgs","repos_url":"https://api.github.com/users/pandas-dev/repos","events_url":"https://api.github.com/users/pandas-dev/events{/privacy}","received_events_url":"https://api.github.com/users/pandas-dev/received_events","type":"Organization","site_admin":false},"repo":{"id":858127,"node_id":"MDEwOlJlcG9zaXRvcnk4NTgxMjc=","name":"pandas","full_name":"pandas-dev/pandas","owner":{"login":"pandas-dev","id":21206976,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIxMjA2OTc2","avatar_url":"https://avatars2.githubusercontent.com/u/21206976?v=4","gravatar_id":"","url":"https://api.github.com/users/pandas-dev","html_url":"https://github.com/pandas-dev","followers_url":"https://api.github.com/users/pandas-dev/followers","following_url":"https://api.github.com/users/pandas-dev/following{/other_user}","gists_url":"https://api.github.com/users/pandas-dev/gists{/gist_id}","starred_url":"https://api.github.com/users/pandas-dev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pandas-dev/subscriptions","organizations_url":"https://api.github.com/users/pandas-dev/orgs","repos_url":"https://api.github.com/users/pandas-dev/repos","events_url":"https://api.github.com/users/pandas-dev/events{/privacy}","received_events_url":"https://api.github.com/users/pandas-dev/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pandas-dev/pandas","description":"Flexible and powerful data analysis / manipulation library for Python, providing labeled data structures similar to R data.frame objects, statistical functions, and much more","fork":false,"url":"https://api.github.com/repos/pandas-dev/pandas","forks_url":"https://api.github.com/repos/pandas-dev/pandas/forks","keys_url":"https://api.github.com/repos/pandas-dev/pandas/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pandas-dev/pandas/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pandas-dev/pandas/teams","hooks_url":"https://api.github.com/repos/pandas-dev/pandas/hooks","issue_events_url":"https://api.github.com/repos/pandas-dev/pandas/issues/events{/number}","events_url":"https://api.github.com/repos/pandas-dev/pandas/events","assignees_url":"https://api.github.com/repos/pandas-dev/pandas/assignees{/user}","branches_url":"https://api.github.com/repos/pandas-dev/pandas/branches{/branch}","tags_url":"https://api.github.com/repos/pandas-dev/pandas/tags","blobs_url":"https://api.github.com/repos/pandas-dev/pandas/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pandas-dev/pandas/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pandas-dev/pandas/git/refs{/sha}","trees_url":"https://api.github.com/repos/pandas-dev/pandas/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pandas-dev/pandas/statuses/{sha}","languages_url":"https://api.github.com/repos/pandas-dev/pandas/languages","stargazers_url":"https://api.github.com/repos/pandas-dev/pandas/stargazers","contributors_url":"https://api.github.com/repos/pandas-dev/pandas/contributors","subscribers_url":"https://api.github.com/repos/pandas-dev/pandas/subscribers","subscription_url":"https://api.github.com/repos/pandas-dev/pandas/subscription","commits_url":"https://api.github.com/repos/pandas-dev/pandas/commits{/sha}","git_commits_url":"https://api.github.com/repos/pandas-dev/pandas/git/commits{/sha}","comments_url":"https://api.github.com/repos/pandas-dev/pandas/comments{/number}","issue_comment_url":"https://api.github.com/repos/pandas-dev/pandas/issues/comments{/number}","contents_url":"https://api.github.com/repos/pandas-dev/pandas/contents/{+path}","compare_url":"https://api.github.com/repos/pandas-dev/pandas/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pandas-dev/pandas/merges","archive_url":"https://api.github.com/repos/pandas-dev/pandas/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pandas-dev/pandas/downloads","issues_url":"https://api.github.com/repos/pandas-dev/pandas/issues{/number}","pulls_url":"https://api.github.com/repos/pandas-dev/pandas/pulls{/number}","milestones_url":"https://api.github.com/repos/pandas-dev/pandas/milestones{/number}","notifications_url":"https://api.github.com/repos/pandas-dev/pandas/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pandas-dev/pandas/labels{/name}","releases_url":"https://api.github.com/repos/pandas-dev/pandas/releases{/id}","deployments_url":"https://api.github.com/repos/pandas-dev/pandas/deployments","created_at":"2010-08-24T01:37:33Z","updated_at":"2018-07-27T11:54:07Z","pushed_at":"2018-07-27T11:59:36Z","git_url":"git://github.com/pandas-dev/pandas.git","ssh_url":"git@github.com:pandas-dev/pandas.git","clone_url":"https://github.com/pandas-dev/pandas.git","svn_url":"https://github.com/pandas-dev/pandas","homepage":"http://pandas.pydata.org","size":128221,"stargazers_count":15280,"watchers_count":15280,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":6140,"mirror_url":null,"archived":false,"open_issues_count":2657,"license":{"key":"bsd-3-clause","name":"BSD 3-Clause \"New\" or \"Revised\" License","spdx_id":"BSD-3-Clause","url":"https://api.github.com/licenses/bsd-3-clause","node_id":"MDc6TGljZW5zZTU="},"forks":6140,"open_issues":2657,"watchers":15280,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pandas-dev/pandas/pulls/22063"},"html":{"href":"https://github.com/pandas-dev/pandas/pull/22063"},"issue":{"href":"https://api.github.com/repos/pandas-dev/pandas/issues/22063"},"comments":{"href":"https://api.github.com/repos/pandas-dev/pandas/issues/22063/comments"},"review_comments":{"href":"https://api.github.com/repos/pandas-dev/pandas/pulls/22063/comments"},"review_comment":{"href":"https://api.github.com/repos/pandas-dev/pandas/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pandas-dev/pandas/pulls/22063/commits"},"statuses":{"href":"https://api.github.com/repos/pandas-dev/pandas/statuses/98bd79a4501c1a87f68806980fa67c7eb1fc98b3"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"holymonson"}}