{"action":"closed","issue":{"url":"https://api.github.com/repos/pydata/pandas/issues/11626","labels_url":"https://api.github.com/repos/pydata/pandas/issues/11626/labels{/name}","comments_url":"https://api.github.com/repos/pydata/pandas/issues/11626/comments","events_url":"https://api.github.com/repos/pydata/pandas/issues/11626/events","html_url":"https://github.com/pydata/pandas/issues/11626","id":117334954,"number":11626,"title":"AmbiguousTimeError when constructing a Series with DST change","user":{"login":"JackKelly","id":460756,"avatar_url":"https://avatars.githubusercontent.com/u/460756?v=3","gravatar_id":"","url":"https://api.github.com/users/JackKelly","html_url":"https://github.com/JackKelly","followers_url":"https://api.github.com/users/JackKelly/followers","following_url":"https://api.github.com/users/JackKelly/following{/other_user}","gists_url":"https://api.github.com/users/JackKelly/gists{/gist_id}","starred_url":"https://api.github.com/users/JackKelly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JackKelly/subscriptions","organizations_url":"https://api.github.com/users/JackKelly/orgs","repos_url":"https://api.github.com/users/JackKelly/repos","events_url":"https://api.github.com/users/JackKelly/events{/privacy}","received_events_url":"https://api.github.com/users/JackKelly/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/Timezones","name":"Timezones","color":"5319e7"}],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/pydata/pandas/milestones/37","html_url":"https://github.com/pydata/pandas/milestones/0.17.1","labels_url":"https://api.github.com/repos/pydata/pandas/milestones/37/labels","id":1299459,"number":37,"title":"0.17.1","description":"after 0.17.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":8,"closed_issues":173,"state":"open","created_at":"2015-09-10T14:30:44Z","updated_at":"2015-11-17T12:18:23Z","due_on":"2015-11-21T05:00:00Z","closed_at":null},"comments":0,"created_at":"2015-11-17T11:26:22Z","updated_at":"2015-11-17T12:18:23Z","closed_at":"2015-11-17T12:18:23Z","body":"In Pandas 0.17, if I construct a `Series` which contains a day light saving transition, then Pandas crashes with an `AmbiguousTimeError`.\r\n\r\nHere's the minimal code example to reproduce the bug:\r\n\r\n```python\r\nimport pandas as pd\r\nindex = pd.date_range(\"2013-10-26 23:00\", \"2013-10-27 01:00\",\r\n                      tz=\"Europe/London\", freq=\"H\")\r\nseries = pd.Series(0, index=index)\r\n```\r\n\r\nAnd here's the traceback:\r\n\r\n```python\r\nIn [4]: ---------------------------------------------------------------------------\r\nAmbiguousTimeError                        Traceback (most recent call last)\r\n<ipython-input-4-5deb3c83fafd> in <module>()\r\n----> 1 __pyfile = open('''/tmp/py7201vZi''');exec(compile(__pyfile.read(), '''/home/jack/temp/pandas_dst_bug.py''', 'exec'));__pyfile.close(); import os; os.remove('''/tmp/py7201vZi''')\r\n\r\n/home/jack/temp/pandas_dst_bug.py in <module>()\r\n      2 index = pd.date_range(\"2013-10-26 23:00\", \"2013-10-27 01:00\",\r\n      3                       tz=\"Europe/London\", freq=\"H\")\r\n----> 4 series = pd.Series(0, index=index)\r\n\r\n\r\n/usr/local/lib/python2.7/dist-packages/pandas/tseries/index.pyc in date_range(start, end, periods, freq, tz, normalize, name, closed)\r\n   1912     return DatetimeIndex(start=start, end=end, periods=periods,\r\n   1913                          freq=freq, tz=tz, normalize=normalize, name=name,\r\n-> 1914                          closed=closed)\r\n   1915 \r\n   1916 \r\n\r\n/usr/local/lib/python2.7/dist-packages/pandas/util/decorators.pyc in wrapper(*args, **kwargs)\r\n     87                 else:\r\n     88                     kwargs[new_arg_name] = new_arg_value\r\n---> 89             return func(*args, **kwargs)\r\n     90         return wrapper\r\n     91     return _deprecate_kwarg\r\n\r\n/usr/local/lib/python2.7/dist-packages/pandas/tseries/index.pyc in __new__(cls, data, freq, start, end, periods, copy, name, tz, verify_integrity, normalize, closed, ambiguous, dtype, **kwargs)\r\n    234             return cls._generate(start, end, periods, name, freq,\r\n    235                                  tz=tz, normalize=normalize, closed=closed,\r\n--> 236                                  ambiguous=ambiguous)\r\n    237 \r\n    238         if not isinstance(data, (np.ndarray, Index, ABCSeries)):\r\n\r\n/usr/local/lib/python2.7/dist-packages/pandas/tseries/index.pyc in _generate(cls, start, end, periods, name, offset, tz, normalize, ambiguous, closed)\r\n    450 \r\n    451                 if end is not None and end.tz is None:\r\n--> 452                     end = end.tz_localize(tz)\r\n    453 \r\n    454             if start and end:\r\n\r\npandas/tslib.pyx in pandas.tslib.Timestamp.tz_localize (pandas/tslib.c:11965)()\r\n\r\npandas/tslib.pyx in pandas.tslib.tz_localize_to_utc (pandas/tslib.c:64516)()\r\n\r\nAmbiguousTimeError: Cannot infer dst time from Timestamp('2013-10-27 01:00:00'), try using the 'ambiguous' argument\r\n```\r\n\r\nI'm not certain but I expect this bug is related to #11619\r\n\r\nThis bug report follows on from #11624\r\n\r\nI'm 99.999% certain that this bug did not exist in Pandas 0.16.2\r\n\r\n```\r\nIn [30]: show_versions()\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.19.0-33-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.17.0\r\nnose: 1.3.7\r\npip: 1.5.6\r\nsetuptools: 15.2\r\nCython: 0.23.1\r\nnumpy: 1.10.1\r\nscipy: 0.16.0\r\nstatsmodels: 0.6.1\r\nIPython: 4.0.0\r\nsphinx: 1.2.3\r\npatsy: 0.3.0\r\ndateutil: 2.4.2\r\npytz: 2015.7\r\nblosc: None\r\nbottleneck: None\r\ntables: 3.2.2\r\nnumexpr: 2.4.6\r\nmatplotlib: 1.4.3\r\nopenpyxl: None\r\nxlrd: 0.9.2\r\nxlwt: None\r\nxlsxwriter: None\r\nlxml: None\r\nbs4: 4.3.2\r\nhtml5lib: 0.999\r\nhttplib2: 0.9\r\napiclient: None\r\nsqlalchemy: None\r\npymysql: None\r\npsycopg2: 2.5.3 (dt dec pq3 ext)\r\n```\r\n\r\nFinally, just to say another huge thank you to everyone who supports Pandas.  It must be a huge amount of work and I am hugely grateful.  Pandas is an awesome tool.  Thank you."}}