{"action":"created","issue":{"url":"https://api.github.com/repos/pydata/pandas/issues/7160","repository_url":"https://api.github.com/repos/pydata/pandas","labels_url":"https://api.github.com/repos/pydata/pandas/issues/7160/labels{/name}","comments_url":"https://api.github.com/repos/pydata/pandas/issues/7160/comments","events_url":"https://api.github.com/repos/pydata/pandas/issues/7160/events","html_url":"https://github.com/pydata/pandas/issues/7160","id":33744974,"number":7160,"title":"Bug in read_csv with duplicated column names","user":{"login":"rafaljozefowicz","id":2983769,"avatar_url":"https://avatars.githubusercontent.com/u/2983769?v=3","gravatar_id":"","url":"https://api.github.com/users/rafaljozefowicz","html_url":"https://github.com/rafaljozefowicz","followers_url":"https://api.github.com/users/rafaljozefowicz/followers","following_url":"https://api.github.com/users/rafaljozefowicz/following{/other_user}","gists_url":"https://api.github.com/users/rafaljozefowicz/gists{/gist_id}","starred_url":"https://api.github.com/users/rafaljozefowicz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rafaljozefowicz/subscriptions","organizations_url":"https://api.github.com/users/rafaljozefowicz/orgs","repos_url":"https://api.github.com/users/rafaljozefowicz/repos","events_url":"https://api.github.com/users/rafaljozefowicz/events{/privacy}","received_events_url":"https://api.github.com/users/rafaljozefowicz/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/pydata/pandas/labels/Bug","name":"Bug","color":"e10c02"},{"url":"https://api.github.com/repos/pydata/pandas/labels/CSV","name":"CSV","color":"5319e7"},{"url":"https://api.github.com/repos/pydata/pandas/labels/Difficulty%20Intermediate","name":"Difficulty Intermediate","color":"fbca04"},{"url":"https://api.github.com/repos/pydata/pandas/labels/Effort%20Medium","name":"Effort Medium","color":"006b75"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/pydata/pandas/milestones/32","html_url":"https://github.com/pydata/pandas/milestones/Next%20Major%20Release","labels_url":"https://api.github.com/repos/pydata/pandas/milestones/32/labels","id":933188,"number":32,"title":"Next Major Release","description":"after 0.18.0 of course","creator":{"login":"jreback","id":953992,"avatar_url":"https://avatars.githubusercontent.com/u/953992?v=3","gravatar_id":"","url":"https://api.github.com/users/jreback","html_url":"https://github.com/jreback","followers_url":"https://api.github.com/users/jreback/followers","following_url":"https://api.github.com/users/jreback/following{/other_user}","gists_url":"https://api.github.com/users/jreback/gists{/gist_id}","starred_url":"https://api.github.com/users/jreback/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jreback/subscriptions","organizations_url":"https://api.github.com/users/jreback/orgs","repos_url":"https://api.github.com/users/jreback/repos","events_url":"https://api.github.com/users/jreback/events{/privacy}","received_events_url":"https://api.github.com/users/jreback/received_events","type":"User","site_admin":false},"open_issues":940,"closed_issues":131,"state":"open","created_at":"2015-01-13T10:53:19Z","updated_at":"2016-04-19T12:20:27Z","due_on":"2016-08-31T04:00:00Z","closed_at":null},"comments":5,"created_at":"2014-05-18T04:06:33Z","updated_at":"2016-04-19T16:44:04Z","closed_at":null,"body":"Tested on 0.13.0, 0.13.1 and 0.14.0rc1:\r\n```python\r\nfrom StringIO import StringIO\r\nimport pandas as pd\r\n\r\n# this is correct\r\nprint(pd.DataFrame([[0, 1, 2], [3, 4, 5]], columns=[\"a\", \"b\", \"a\"]))\r\n# and this is fine as well\r\n# (although, changing the column names to a,b,a.1)\r\nprint(pd.read_csv(StringIO(\"a,b,a\\n0,1,2\\n3,4,5\")))\r\n# but this is not correct\r\nprint(pd.read_csv(StringIO(\"0,1,2\\n3,4,5\"), names=[\"a\", \"b\", \"a\"]))\r\n```\r\n\r\nThe last one returns:\r\n```\r\nOut[5]: \r\n   a  b  a\r\n0  2  1  2\r\n1  5  4  5\r\n```\r\n\r\nI would expect all 3 methods to return the same DataFrame. I noticed this when I wanted to read csv file that had a separate file with a header (and a duplicated column in it). BTW is there a better way to do it than to read the header file first and pass the output into 'names' parameter of read_csv?"},"comment":{"url":"https://api.github.com/repos/pydata/pandas/issues/comments/212010862","html_url":"https://github.com/pydata/pandas/issues/7160#issuecomment-212010862","issue_url":"https://api.github.com/repos/pydata/pandas/issues/7160","id":212010862,"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},"created_at":"2016-04-19T16:44:04Z","updated_at":"2016-04-19T16:44:04Z","body":"@jreback : Question, what does the `as_recarray` option do exactly?  And, should we be raising an `Exception` in the third example if we set `as_recarray=True`?"}}