{"action":"created","comment":{"url":"https://api.github.com/repos/pandas-dev/pandas/pulls/comments/94122004","pull_request_review_id":14652398,"id":94122004,"diff_hunk":"@@ -629,48 +626,155 @@ cdef extern from \"parse_helper.h\":\n \n cdef int64_t iINT64_MAX = <int64_t> INT64_MAX\n cdef int64_t iINT64_MIN = <int64_t> INT64_MIN\n+cdef uint64_t iUINT64_MAX = <uint64_t> UINT64_MAX\n \n \n-def maybe_convert_numeric(object[:] values, set na_values,\n+def maybe_convert_numeric(ndarray[object] values, set na_values,\n                           bint convert_empty=True, bint coerce_numeric=False):\n     \"\"\"\n-    Type inference function-- convert strings to numeric (potentially) and\n-    convert to proper dtype array\n+    Convert object array to a numeric array if possible.\n+\n+    Parameters\n+    ----------\n+    values : ndarray\n+        Array of object elements to convert.\n+    na_values : set\n+        Set of values that should be interpreted as NaN.\n+    convert_empty : bool, default True\n+        If an empty array-like object is encountered, whether to interpret\n+        that element as NaN or not. If set to False, a ValueError will be\n+        raised if such an element is encountered and 'coerce_numeric' is False.\n+    coerce_numeric : bool, default False\n+        If initial attempts to convert to numeric have failed, whether to\n+        force conversion to numeric via alternative methods or by setting the\n+        element to NaN. Otherwise, an Exception will be raised when such an\n+        element is encountered.\n+\n+        This boolean also has an impact on how conversion behaves when a\n+        numeric array has no suitable numerical dtype to return (i.e. uint64,\n+        int32, uint8). If set to False, the original object array will be\n+        returned. Otherwise, a ValueError will be raised.\n+\n+    Returns\n+    -------\n+    numeric_array : array of converted object values to numerical ones\n     \"\"\"\n     cdef:\n         int status, maybe_int\n         Py_ssize_t i, n = values.size\n         ndarray[float64_t] floats = np.empty(n, dtype='f8')\n         ndarray[complex128_t] complexes = np.empty(n, dtype='c16')\n         ndarray[int64_t] ints = np.empty(n, dtype='i8')\n+        ndarray[uint64_t] uints = np.empty(n, dtype='u8')\n         ndarray[uint8_t] bools = np.empty(n, dtype='u1')\n+        bint seen_null = False\n+        bint seen_uint = False\n+        bint seen_sint = False\n         bint seen_float = False\n         bint seen_complex = False\n         bint seen_int = False\n         bint seen_bool = False\n         object val\n         float64_t fval\n \n+    def check_uint64_nan():\n+        \"\"\"\n+        Check whether we have encountered uint64 when handling a NaN element.\n+\n+        If uint64 has been encountered, we cannot safely cast to float64 due\n+        to truncation problems (this would occur if we return a numeric array\n+        containing a NaN element).\n+\n+        Returns\n+        -------\n+        return_values : bool\n+            Whether or not we should return the original input array to avoid\n+            data truncation.\n+        \"\"\"\n+        if seen_null and seen_uint:\n+            if not coerce_numeric:\n+                return True\n+            else:\n+                raise ValueError(\"uint64 array detected, and such an \"\n+                                 \"array cannot contain NaN.\")\n+\n+        return False\n+\n+    def check_uint64_int64_conflict():\n+        \"\"\"\n+        Check whether we have encountered both int64 and uint64 elements.\n+\n+        If bot have been encountered, we cannot safely cast to an integer\n+        dtype since none is large enough to hold both types of elements.\n+\n+        Returns\n+        -------\n+        return_values : bool\n+            Whether or not we should return the original input array to avoid\n+            data truncation.\n+        \"\"\"","path":"pandas/src/inference.pyx","position":null,"original_position":103,"commit_id":"c10449caa8e78ca5a9a073e2eaf28521723cfca2","original_commit_id":"e15620f71da09d6d4cec51ac18870ecaeeb06a4d","user":{"login":"gfyoung","id":9273653,"avatar_url":"https://avatars.githubusercontent.com/u/9273653?v=3","gravatar_id":"","url":"https://api.github.com/users/gfyoung","html_url":"https://github.com/gfyoung","followers_url":"https://api.github.com/users/gfyoung/followers","following_url":"https://api.github.com/users/gfyoung/following{/other_user}","gists_url":"https://api.github.com/users/gfyoung/gists{/gist_id}","starred_url":"https://api.github.com/users/gfyoung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gfyoung/subscriptions","organizations_url":"https://api.github.com/users/gfyoung/orgs","repos_url":"https://api.github.com/users/gfyoung/repos","events_url":"https://api.github.com/users/gfyoung/events{/privacy}","received_events_url":"https://api.github.com/users/gfyoung/received_events","type":"User","site_admin":false},"body":"Sounds good.  Will do.","created_at":"2016-12-29T10:31:26Z","updated_at":"2016-12-29T10:31:26Z","html_url":"https://github.com/pandas-dev/pandas/pull/15005#discussion_r94122004","pull_request_url":"https://api.github.com/repos/pandas-dev/pandas/pulls/15005","_links":{"self":{"href":"https://api.github.com/repos/pandas-dev/pandas/pulls/comments/94122004"},"html":{"href":"https://github.com/pandas-dev/pandas/pull/15005#discussion_r94122004"},"pull_request":{"href":"https://api.github.com/repos/pandas-dev/pandas/pulls/15005"}}},"pull_request":{"url":"https://api.github.com/repos/pandas-dev/pandas/pulls/15005","id":99586502,"html_url":"https://github.com/pandas-dev/pandas/pull/15005","diff_url":"https://github.com/pandas-dev/pandas/pull/15005.diff","patch_url":"https://github.com/pandas-dev/pandas/pull/15005.patch","issue_url":"https://api.github.com/repos/pandas-dev/pandas/issues/15005","number":15005,"state":"open","locked":false,"title":"BUG: Convert uint64 in maybe_convert_numeric","user":{"login":"gfyoung","id":9273653,"avatar_url":"https://avatars.githubusercontent.com/u/9273653?v=3","gravatar_id":"","url":"https://api.github.com/users/gfyoung","html_url":"https://github.com/gfyoung","followers_url":"https://api.github.com/users/gfyoung/followers","following_url":"https://api.github.com/users/gfyoung/following{/other_user}","gists_url":"https://api.github.com/users/gfyoung/gists{/gist_id}","starred_url":"https://api.github.com/users/gfyoung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gfyoung/subscriptions","organizations_url":"https://api.github.com/users/gfyoung/orgs","repos_url":"https://api.github.com/users/gfyoung/repos","events_url":"https://api.github.com/users/gfyoung/events{/privacy}","received_events_url":"https://api.github.com/users/gfyoung/received_events","type":"User","site_admin":false},"body":"Add handling for `uint64` elements in an array with the follow behavior specifications:\r\n\r\n1) If `uint64` and `NaN` are both detected, the original input will be returned if `coerce_numeric`\r\nis `False`. Otherwise, an `Exception` is raised.\r\n\r\n2) If `uint64` and negative numbers are both detected, the original input be returned if `coerce_numeric` is `False`. Otherwise, an `Exception` is raised.\r\n\r\nCloses #14982.\r\nPartial fix for #14983.","created_at":"2016-12-28T19:54:53Z","updated_at":"2016-12-29T10:31:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ec77b99bf2068ac46c64dc099e800bc508b59ce9","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/pandas-dev/pandas/pulls/15005/commits","review_comments_url":"https://api.github.com/repos/pandas-dev/pandas/pulls/15005/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/15005/comments","statuses_url":"https://api.github.com/repos/pandas-dev/pandas/statuses/c10449caa8e78ca5a9a073e2eaf28521723cfca2","head":{"label":"gfyoung:maybe-convert-numeric-uint64","ref":"maybe-convert-numeric-uint64","sha":"c10449caa8e78ca5a9a073e2eaf28521723cfca2","user":{"login":"gfyoung","id":9273653,"avatar_url":"https://avatars.githubusercontent.com/u/9273653?v=3","gravatar_id":"","url":"https://api.github.com/users/gfyoung","html_url":"https://github.com/gfyoung","followers_url":"https://api.github.com/users/gfyoung/followers","following_url":"https://api.github.com/users/gfyoung/following{/other_user}","gists_url":"https://api.github.com/users/gfyoung/gists{/gist_id}","starred_url":"https://api.github.com/users/gfyoung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gfyoung/subscriptions","organizations_url":"https://api.github.com/users/gfyoung/orgs","repos_url":"https://api.github.com/users/gfyoung/repos","events_url":"https://api.github.com/users/gfyoung/events{/privacy}","received_events_url":"https://api.github.com/users/gfyoung/received_events","type":"User","site_admin":false},"repo":{"id":51449909,"name":"pandas","full_name":"gfyoung/pandas","owner":{"login":"gfyoung","id":9273653,"avatar_url":"https://avatars.githubusercontent.com/u/9273653?v=3","gravatar_id":"","url":"https://api.github.com/users/gfyoung","html_url":"https://github.com/gfyoung","followers_url":"https://api.github.com/users/gfyoung/followers","following_url":"https://api.github.com/users/gfyoung/following{/other_user}","gists_url":"https://api.github.com/users/gfyoung/gists{/gist_id}","starred_url":"https://api.github.com/users/gfyoung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gfyoung/subscriptions","organizations_url":"https://api.github.com/users/gfyoung/orgs","repos_url":"https://api.github.com/users/gfyoung/repos","events_url":"https://api.github.com/users/gfyoung/events{/privacy}","received_events_url":"https://api.github.com/users/gfyoung/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/gfyoung/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/gfyoung/pandas","forks_url":"https://api.github.com/repos/gfyoung/pandas/forks","keys_url":"https://api.github.com/repos/gfyoung/pandas/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gfyoung/pandas/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gfyoung/pandas/teams","hooks_url":"https://api.github.com/repos/gfyoung/pandas/hooks","issue_events_url":"https://api.github.com/repos/gfyoung/pandas/issues/events{/number}","events_url":"https://api.github.com/repos/gfyoung/pandas/events","assignees_url":"https://api.github.com/repos/gfyoung/pandas/assignees{/user}","branches_url":"https://api.github.com/repos/gfyoung/pandas/branches{/branch}","tags_url":"https://api.github.com/repos/gfyoung/pandas/tags","blobs_url":"https://api.github.com/repos/gfyoung/pandas/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gfyoung/pandas/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gfyoung/pandas/git/refs{/sha}","trees_url":"https://api.github.com/repos/gfyoung/pandas/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gfyoung/pandas/statuses/{sha}","languages_url":"https://api.github.com/repos/gfyoung/pandas/languages","stargazers_url":"https://api.github.com/repos/gfyoung/pandas/stargazers","contributors_url":"https://api.github.com/repos/gfyoung/pandas/contributors","subscribers_url":"https://api.github.com/repos/gfyoung/pandas/subscribers","subscription_url":"https://api.github.com/repos/gfyoung/pandas/subscription","commits_url":"https://api.github.com/repos/gfyoung/pandas/commits{/sha}","git_commits_url":"https://api.github.com/repos/gfyoung/pandas/git/commits{/sha}","comments_url":"https://api.github.com/repos/gfyoung/pandas/comments{/number}","issue_comment_url":"https://api.github.com/repos/gfyoung/pandas/issues/comments{/number}","contents_url":"https://api.github.com/repos/gfyoung/pandas/contents/{+path}","compare_url":"https://api.github.com/repos/gfyoung/pandas/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gfyoung/pandas/merges","archive_url":"https://api.github.com/repos/gfyoung/pandas/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gfyoung/pandas/downloads","issues_url":"https://api.github.com/repos/gfyoung/pandas/issues{/number}","pulls_url":"https://api.github.com/repos/gfyoung/pandas/pulls{/number}","milestones_url":"https://api.github.com/repos/gfyoung/pandas/milestones{/number}","notifications_url":"https://api.github.com/repos/gfyoung/pandas/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gfyoung/pandas/labels{/name}","releases_url":"https://api.github.com/repos/gfyoung/pandas/releases{/id}","deployments_url":"https://api.github.com/repos/gfyoung/pandas/deployments","created_at":"2016-02-10T15:31:30Z","updated_at":"2016-02-10T15:31:35Z","pushed_at":"2016-12-29T10:30:51Z","git_url":"git://github.com/gfyoung/pandas.git","ssh_url":"git@github.com:gfyoung/pandas.git","clone_url":"https://github.com/gfyoung/pandas.git","svn_url":"https://github.com/gfyoung/pandas","homepage":"http://pandas.pydata.org","size":85989,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"pandas-dev:master","ref":"master","sha":"975a440b08cce771e286de86706fa213d6479d45","user":{"login":"pandas-dev","id":21206976,"avatar_url":"https://avatars.githubusercontent.com/u/21206976?v=3","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,"name":"pandas","full_name":"pandas-dev/pandas","owner":{"login":"pandas-dev","id":21206976,"avatar_url":"https://avatars.githubusercontent.com/u/21206976?v=3","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":"2016-12-29T07:07:45Z","pushed_at":"2016-12-29T10:31:00Z","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":86215,"stargazers_count":7685,"watchers_count":7685,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":3203,"mirror_url":null,"open_issues_count":1855,"forks":3203,"open_issues":1855,"watchers":7685,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pandas-dev/pandas/pulls/15005"},"html":{"href":"https://github.com/pandas-dev/pandas/pull/15005"},"issue":{"href":"https://api.github.com/repos/pandas-dev/pandas/issues/15005"},"comments":{"href":"https://api.github.com/repos/pandas-dev/pandas/issues/15005/comments"},"review_comments":{"href":"https://api.github.com/repos/pandas-dev/pandas/pulls/15005/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/15005/commits"},"statuses":{"href":"https://api.github.com/repos/pandas-dev/pandas/statuses/c10449caa8e78ca5a9a073e2eaf28521723cfca2"}}}}
{"actor":{"display_login":"gfyoung"}}