{"action":"created","issue":{"url":"https://api.github.com/repos/astropy/astropy/issues/4934","repository_url":"https://api.github.com/repos/astropy/astropy","labels_url":"https://api.github.com/repos/astropy/astropy/issues/4934/labels{/name}","comments_url":"https://api.github.com/repos/astropy/astropy/issues/4934/comments","events_url":"https://api.github.com/repos/astropy/astropy/issues/4934/events","html_url":"https://github.com/astropy/astropy/issues/4934","id":155103749,"number":4934,"title":"ASCII read converters don't take lambda function","user":{"login":"pllim","id":2090236,"avatar_url":"https://avatars.githubusercontent.com/u/2090236?v=3","gravatar_id":"","url":"https://api.github.com/users/pllim","html_url":"https://github.com/pllim","followers_url":"https://api.github.com/users/pllim/followers","following_url":"https://api.github.com/users/pllim/following{/other_user}","gists_url":"https://api.github.com/users/pllim/gists{/gist_id}","starred_url":"https://api.github.com/users/pllim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pllim/subscriptions","organizations_url":"https://api.github.com/users/pllim/orgs","repos_url":"https://api.github.com/users/pllim/repos","events_url":"https://api.github.com/users/pllim/events{/privacy}","received_events_url":"https://api.github.com/users/pllim/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/astropy/astropy/labels/io.ascii","name":"io.ascii","color":"c7def8"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-05-16T19:34:54Z","updated_at":"2016-05-17T13:44:04Z","closed_at":null,"body":"I use `ascii.read()` to read a text file containing simple table data. The data by default is interpreted as integer but I want to cast them as float. There are 10 columns, so I have to do this:\r\n\r\n```python\r\nimport numpy as np\r\nfrom astropy.io import ascii\r\n\r\nconverters = {'col1': [ascii.convert_numpy(np.float)],\r\n              'col2': [ascii.convert_numpy(np.float)],\r\n              'col3': [ascii.convert_numpy(np.float)],\r\n              'col4': [ascii.convert_numpy(np.float)],\r\n              'col5': [ascii.convert_numpy(np.float)],\r\n              'col6': [ascii.convert_numpy(np.float)],\r\n              'col7': [ascii.convert_numpy(np.float)],\r\n              'col8': [ascii.convert_numpy(np.float)],\r\n              'col9': [ascii.convert_numpy(np.float)],\r\n              'col10': [ascii.convert_numpy(np.float)]}\r\n\r\ntab = ascii.read(inputfile, converters=converters, ...)\r\n```\r\n\r\nI tried to be lazy and use the following instead but it does not work, although it is theoretically equivalent:\r\n\r\n```python\r\nfrom collections import defaultdict\r\n\r\nconverters = defaultdict(lambda: [ascii.convert_numpy(np.float)])\r\n```\r\n\r\nWhy does it not work? Is there a more elegant way (that works) to read data in as float by default?"},"comment":{"url":"https://api.github.com/repos/astropy/astropy/issues/comments/219721513","html_url":"https://github.com/astropy/astropy/issues/4934#issuecomment-219721513","issue_url":"https://api.github.com/repos/astropy/astropy/issues/4934","id":219721513,"user":{"login":"pllim","id":2090236,"avatar_url":"https://avatars.githubusercontent.com/u/2090236?v=3","gravatar_id":"","url":"https://api.github.com/users/pllim","html_url":"https://github.com/pllim","followers_url":"https://api.github.com/users/pllim/followers","following_url":"https://api.github.com/users/pllim/following{/other_user}","gists_url":"https://api.github.com/users/pllim/gists{/gist_id}","starred_url":"https://api.github.com/users/pllim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pllim/subscriptions","organizations_url":"https://api.github.com/users/pllim/orgs","repos_url":"https://api.github.com/users/pllim/repos","events_url":"https://api.github.com/users/pllim/events{/privacy}","received_events_url":"https://api.github.com/users/pllim/received_events","type":"User","site_admin":false},"created_at":"2016-05-17T13:44:04Z","updated_at":"2016-05-17T13:44:04Z","body":"@simongibbons , thanks!\r\n\r\nI guess the next question is would it make sense to expand `io.ascii` to support `defaultdict`? "}}