{"action":"created","issue":{"url":"https://api.github.com/repos/pandas-dev/pandas/issues/14877","repository_url":"https://api.github.com/repos/pandas-dev/pandas","labels_url":"https://api.github.com/repos/pandas-dev/pandas/issues/14877/labels{/name}","comments_url":"https://api.github.com/repos/pandas-dev/pandas/issues/14877/comments","events_url":"https://api.github.com/repos/pandas-dev/pandas/issues/14877/events","html_url":"https://github.com/pandas-dev/pandas/pull/14877","id":195471004,"number":14877,"title":"BUG: Respect value of raise_on_error","user":{"login":"tomderuijter","id":500436,"avatar_url":"https://avatars.githubusercontent.com/u/500436?v=3","gravatar_id":"","url":"https://api.github.com/users/tomderuijter","html_url":"https://github.com/tomderuijter","followers_url":"https://api.github.com/users/tomderuijter/followers","following_url":"https://api.github.com/users/tomderuijter/following{/other_user}","gists_url":"https://api.github.com/users/tomderuijter/gists{/gist_id}","starred_url":"https://api.github.com/users/tomderuijter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomderuijter/subscriptions","organizations_url":"https://api.github.com/users/tomderuijter/orgs","repos_url":"https://api.github.com/users/tomderuijter/repos","events_url":"https://api.github.com/users/tomderuijter/events{/privacy}","received_events_url":"https://api.github.com/users/tomderuijter/received_events","type":"User","site_admin":false},"labels":[{"id":42670965,"url":"https://api.github.com/repos/pandas-dev/pandas/labels/Error%20Reporting","name":"Error Reporting","color":"ffa0ff","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-12-14T08:41:37Z","updated_at":"2016-12-14T09:51:51Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/pandas-dev/pandas/pulls/14877","html_url":"https://github.com/pandas-dev/pandas/pull/14877","diff_url":"https://github.com/pandas-dev/pandas/pull/14877.diff","patch_url":"https://github.com/pandas-dev/pandas/pull/14877.patch"},"body":"#### Code Sample, a copy-pastable example if possible\r\n\r\nPasteable snippet.\r\n```python\r\nimport numpy as np\r\nimport pandas as pd\r\nx = pd.DataFrame(data=[[1,2],[3,4]], columns=['A','B'])\r\nx.astype({'C': np.int32}, raise_on_error=False)\r\n```\r\n\r\nOutput\r\n```\r\nTraceback (most recent call last):\r\n  File \"<stdin>\", line 1, in <module>\r\n  File \"/Users/tomdr/VirtualEnvs/work-py3/lib/python3.5/site-packages/pandas/core/generic.py\", line 3041, in astype\r\n    raise KeyError('Only a column name can be used for the '\r\nKeyError: 'Only a column name can be used for the key in a dtype mappings argument.'\r\n```\r\n#### Problem description\r\n\r\nThe method argument `raise_on_error` of `DataFrame.astype` suggests there is the option to ignore errors caused by mismatch in column names. Currently, an exception is raised regardless of the value of this argument. This is fixed in this pull request.\r\n\r\nBefore: https://github.com/pandas-dev/pandas/blob/v0.19.1/pandas/core/generic.py#L3041 \r\n\r\n#### Expected Output\r\n\r\nAn exception should not be raised. \r\n\r\n#### Output of ``pd.show_versions()``\r\n\r\n<details>\r\nINSTALLED VERSIONS\r\n------------------\r\ncommit: None\r\npython: 3.5.1.final.0\r\npython-bits: 64\r\nOS: Darwin\r\nOS-release: 15.6.0\r\nmachine: x86_64\r\nprocessor: i386\r\nbyteorder: little\r\nLC_ALL: en_US.UTF-8\r\nLANG: en_US.UTF-8\r\nLOCALE: en_US.UTF-8\r\n\r\npandas: 0.19.1\r\nnose: 1.3.7\r\npip: 9.0.1\r\nsetuptools: 21.0.0\r\nCython: 0.24.1\r\nnumpy: 1.11.2\r\nscipy: 0.18.1\r\nstatsmodels: None\r\nxarray: None\r\nIPython: 5.0.0\r\nsphinx: 1.4.8\r\npatsy: None\r\ndateutil: 2.6.0\r\npytz: 2016.10\r\nblosc: None\r\nbottleneck: None\r\ntables: None\r\nnumexpr: None\r\nmatplotlib: 1.5.3\r\nopenpyxl: None\r\nxlrd: None\r\nxlwt: None\r\nxlsxwriter: None\r\nlxml: None\r\nbs4: 4.5.1\r\nhtml5lib: None\r\nhttplib2: None\r\napiclient: None\r\nsqlalchemy: 1.0.14\r\npymysql: 0.7.9.None\r\npsycopg2: 2.6.2 (dt dec pq3 ext lo64)\r\njinja2: 2.8\r\nboto: None\r\npandas_datareader: None\r\n</details>\r\n"},"comment":{"url":"https://api.github.com/repos/pandas-dev/pandas/issues/comments/266990972","html_url":"https://github.com/pandas-dev/pandas/pull/14877#issuecomment-266990972","issue_url":"https://api.github.com/repos/pandas-dev/pandas/issues/14877","id":266990972,"user":{"login":"sinhrks","id":1696302,"avatar_url":"https://avatars.githubusercontent.com/u/1696302?v=3","gravatar_id":"","url":"https://api.github.com/users/sinhrks","html_url":"https://github.com/sinhrks","followers_url":"https://api.github.com/users/sinhrks/followers","following_url":"https://api.github.com/users/sinhrks/following{/other_user}","gists_url":"https://api.github.com/users/sinhrks/gists{/gist_id}","starred_url":"https://api.github.com/users/sinhrks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sinhrks/subscriptions","organizations_url":"https://api.github.com/users/sinhrks/orgs","repos_url":"https://api.github.com/users/sinhrks/repos","events_url":"https://api.github.com/users/sinhrks/events{/privacy}","received_events_url":"https://api.github.com/users/sinhrks/received_events","type":"User","site_admin":false},"created_at":"2016-12-14T09:51:51Z","updated_at":"2016-12-14T09:51:51Z","body":"I understand the keyword is to ignore dtype conversion error, not input validation. So I think the documentation should be fixed to clarify this. \r\n\r\nIf we're ignoring all kinds of errors, you should fix ``KeyError`` raised from ``Series``."}}
{"actor":{"display_login":"sinhrks"}}