{"action":"created","issue":{"url":"https://api.github.com/repos/pydata/pandas/issues/9178","labels_url":"https://api.github.com/repos/pydata/pandas/issues/9178/labels{/name}","comments_url":"https://api.github.com/repos/pydata/pandas/issues/9178/comments","events_url":"https://api.github.com/repos/pydata/pandas/issues/9178/events","html_url":"https://github.com/pydata/pandas/issues/9178","id":53200037,"number":9178,"title":"Crash on read_html(url, flavor=\"bs4\") if table has only one column","user":{"login":"boarpig","id":1266076,"avatar_url":"https://avatars.githubusercontent.com/u/1266076?v=3","gravatar_id":"","url":"https://api.github.com/users/boarpig","html_url":"https://github.com/boarpig","followers_url":"https://api.github.com/users/boarpig/followers","following_url":"https://api.github.com/users/boarpig/following{/other_user}","gists_url":"https://api.github.com/users/boarpig/gists{/gist_id}","starred_url":"https://api.github.com/users/boarpig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boarpig/subscriptions","organizations_url":"https://api.github.com/users/boarpig/orgs","repos_url":"https://api.github.com/users/boarpig/repos","events_url":"https://api.github.com/users/boarpig/events{/privacy}","received_events_url":"https://api.github.com/users/boarpig/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/HTML","name":"HTML","color":"006b75"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/pydata/pandas/milestones/25","labels_url":"https://api.github.com/repos/pydata/pandas/milestones/25/labels","id":569113,"number":25,"title":"0.16.0","description":"after 0.15 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":880,"closed_issues":122,"state":"open","created_at":"2014-02-14T03:31:22Z","updated_at":"2015-01-02T20:20:20Z","due_on":"2015-02-28T08:00:00Z","closed_at":null},"comments":4,"created_at":"2014-12-31T19:39:48Z","updated_at":"2015-01-03T19:09:09Z","closed_at":null,"body":"I was trying to read a package tracking table from finnish post office's website and I got\r\n\r\n    Traceback (most recent call last):\r\n      File \"./posti.py\", line 69, in <module>\r\n        dfs = read_html(html)\r\n      File \"/usr/lib/python3.4/site-packages/pandas/io/html.py\", line 851, in read_html\r\n        parse_dates, tupleize_cols, thousands, attrs, encoding)\r\n      File \"/usr/lib/python3.4/site-packages/pandas/io/html.py\", line 721, in _parse\r\n        infer_types, parse_dates, tupleize_cols, thousands))\r\n      File \"/usr/lib/python3.4/site-packages/pandas/io/html.py\", line 609, in _data_to_frame\r\n        _expand_elements(body)\r\n      File \"/usr/lib/python3.4/site-packages/pandas/io/html.py\", line 586, in _expand_elements\r\n        lens = Series(lmap(len, body))\r\n      File \"/usr/lib/python3.4/site-packages/pandas/compat/__init__.py\", line 87, in lmap\r\n        return list(map(*args, **kwargs))\r\n    TypeError: len() of unsized object\r\n\r\nI isolated the offending table into this script:\r\n\r\nhttps://gist.github.com/boarpig/de4044f4188fac700c68\r\n\r\nThe problem seems to be related to [`parse_raw_thead`](https://github.com/pydata/pandas/blob/master/pandas/io/html.py#L344) function\r\n\r\n    def _parse_raw_thead(self, table):\r\n        thead = self._parse_thead(table)\r\n        res = []\r\n        if thead:\r\n            res = lmap(self._text_getter, self._parse_th(thead[0]))\r\n        return np.array(res).squeeze() if res and len(res) == 1 else res\r\n\r\nWhere `res` contains `['Tapahtumat']` which comes out of numpy array creation as \r\n\r\n`array('Tapahtumat', dtype='<U10')`\r\n\r\nwhich then produces previously mentioned error because you cannot take a len from that."},"comment":{"url":"https://api.github.com/repos/pydata/pandas/issues/comments/68605680","html_url":"https://github.com/pydata/pandas/issues/9178#issuecomment-68605680","issue_url":"https://api.github.com/repos/pydata/pandas/issues/9178","id":68605680,"user":{"login":"cpcloud","id":417981,"avatar_url":"https://avatars.githubusercontent.com/u/417981?v=3","gravatar_id":"","url":"https://api.github.com/users/cpcloud","html_url":"https://github.com/cpcloud","followers_url":"https://api.github.com/users/cpcloud/followers","following_url":"https://api.github.com/users/cpcloud/following{/other_user}","gists_url":"https://api.github.com/users/cpcloud/gists{/gist_id}","starred_url":"https://api.github.com/users/cpcloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cpcloud/subscriptions","organizations_url":"https://api.github.com/users/cpcloud/orgs","repos_url":"https://api.github.com/users/cpcloud/repos","events_url":"https://api.github.com/users/cpcloud/events{/privacy}","received_events_url":"https://api.github.com/users/cpcloud/received_events","type":"User","site_admin":false},"created_at":"2015-01-03T19:09:09Z","updated_at":"2015-01-03T19:09:09Z","body":"this could be fixed by adding np.atleast_1d after the squeeze call"}}