{"action":"closed","issue":{"url":"https://api.github.com/repos/pydata/pandas/issues/10178","labels_url":"https://api.github.com/repos/pydata/pandas/issues/10178/labels{/name}","comments_url":"https://api.github.com/repos/pydata/pandas/issues/10178/comments","events_url":"https://api.github.com/repos/pydata/pandas/issues/10178/events","html_url":"https://github.com/pydata/pandas/issues/10178","id":78511138,"number":10178,"title":"pd.to_datetime much slower with supplied format than when format is inferred","user":{"login":"dsimmie","id":1150727,"avatar_url":"https://avatars.githubusercontent.com/u/1150727?v=3","gravatar_id":"","url":"https://api.github.com/users/dsimmie","html_url":"https://github.com/dsimmie","followers_url":"https://api.github.com/users/dsimmie/followers","following_url":"https://api.github.com/users/dsimmie/following{/other_user}","gists_url":"https://api.github.com/users/dsimmie/gists{/gist_id}","starred_url":"https://api.github.com/users/dsimmie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dsimmie/subscriptions","organizations_url":"https://api.github.com/users/dsimmie/orgs","repos_url":"https://api.github.com/users/dsimmie/repos","events_url":"https://api.github.com/users/dsimmie/events{/privacy}","received_events_url":"https://api.github.com/users/dsimmie/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/pydata/pandas/labels/Performance","name":"Performance","color":"a10c02"},{"url":"https://api.github.com/repos/pydata/pandas/labels/Timeseries","name":"Timeseries","color":"AFEEEE"}],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/pydata/pandas/milestones/34","html_url":"https://github.com/pydata/pandas/milestones/0.17.0","labels_url":"https://api.github.com/repos/pydata/pandas/milestones/34/labels","id":1033710,"number":34,"title":"0.17.0","description":"","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":185,"closed_issues":141,"state":"open","created_at":"2015-03-23T10:47:38Z","updated_at":"2015-07-20T23:25:42Z","due_on":"2015-07-31T04:00:00Z","closed_at":null},"comments":11,"created_at":"2015-05-20T12:46:20Z","updated_at":"2015-07-20T23:25:42Z","closed_at":"2015-07-20T23:25:42Z","body":"It is **much slower** when converting a date string to supply a date format for a column than for it to be inferred. I would've though there should be less work to do when the format is known (and supplied)\r\n\r\nTo test\r\n\r\n```python\r\ndf = DataFrame({'date_text':[\"2015-05-18\" for i in range(10**6)]})\r\n%timeit pd.to_datetime(df['date_text'],infer_datetime_format=True, box=False).values.view('i8')/10**9\r\n10 loops, best of 3: 115 ms per loop\r\n#Top line from %prun of same command:\r\nncalls  tottime  percall  cumtime  percall filename:lineno(function)\r\n1       0.095    0.095    0.095  0.095   {pandas.tslib.array_to_datetime} \r\n\r\n%timeit pd.to_datetime(df['date_text'],format=\"%Y-%m-%d\", box=False).values.view('i8')/10**9\r\n1 loops, best of 3: 2.27 s per loop\r\n#Top line from %prun of same command:\r\nncalls  tottime  percall  cumtime  percall filename:lineno(function)\r\n1       2.282    2.282    2.282  2.282   {pandas.tslib.array_strptime}\r\n```\r\n\r\nThis plot is taken from this [S/O post](http://stackoverflow.com/questions/30330428/converting-string-date-to-epoch-time-not-working-with-cython-and-posix-c-librari) which shows the difference over a larger range of sizes (and compared to other methods).\r\n\r\n![perf_comparison](https://cloud.githubusercontent.com/assets/1150727/7725765/6d9cb844-fef5-11e4-9051-35a0d983d54e.png)\r\n\r\n\r\n\r\nINSTALLED VERSIONS\r\n------------------\r\ncommit: None\r\npython: 2.7.9.final.0\r\npython-bits: 64\r\nOS: Linux\r\nOS-release: 3.13.0-52-generic\r\nmachine: x86_64\r\nprocessor: x86_64\r\nbyteorder: little\r\nLC_ALL: None\r\nLANG: en_GB.UTF-8\r\n\r\npandas: 0.15.2\r\nnose: 1.3.4\r\nCython: 0.22\r\nnumpy: 1.9.2\r\nscipy: 0.14.0\r\nstatsmodels: 0.5.0\r\nIPython: 2.2.0\r\nsphinx: 1.2.3\r\npatsy: 0.3.0\r\ndateutil: 2.2\r\npytz: 2014.10\r\nbottleneck: None\r\ntables: 3.1.1\r\nnumexpr: 2.3.1\r\nmatplotlib: 1.4.0\r\nopenpyxl: 2.2.0-b1\r\nxlrd: 0.9.3\r\nxlwt: 0.7.5\r\nxlsxwriter: 0.5.7\r\nlxml: 3.4.0\r\nbs4: 4.3.2\r\nhtml5lib: None\r\nhttplib2: 0.9\r\napiclient: 1.4.0\r\nrpy2: None\r\nsqlalchemy: 1.0.0\r\npymysql: None\r\npsycopg2: None"}}