{"action":"created","issue":{"url":"https://api.github.com/repos/pydata/pandas/issues/13956","repository_url":"https://api.github.com/repos/pydata/pandas","labels_url":"https://api.github.com/repos/pydata/pandas/issues/13956/labels{/name}","comments_url":"https://api.github.com/repos/pydata/pandas/issues/13956/comments","events_url":"https://api.github.com/repos/pydata/pandas/issues/13956/events","html_url":"https://github.com/pydata/pandas/issues/13956","id":170409666,"number":13956,"title":"tz_localize, conversion from dst-affected timezone on sorted index","user":{"login":"liori","id":789385,"avatar_url":"https://avatars.githubusercontent.com/u/789385?v=3","gravatar_id":"","url":"https://api.github.com/users/liori","html_url":"https://github.com/liori","followers_url":"https://api.github.com/users/liori/followers","following_url":"https://api.github.com/users/liori/following{/other_user}","gists_url":"https://api.github.com/users/liori/gists{/gist_id}","starred_url":"https://api.github.com/users/liori/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/liori/subscriptions","organizations_url":"https://api.github.com/users/liori/orgs","repos_url":"https://api.github.com/users/liori/repos","events_url":"https://api.github.com/users/liori/events{/privacy}","received_events_url":"https://api.github.com/users/liori/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-08-10T12:53:51Z","updated_at":"2016-08-10T13:25:51Z","closed_at":null,"body":"Polish government provides [data on power demand](http://www.pse.pl/index.php?dzid=78) with local timestamps. DST switches are unfortunately not accounted for, so some timestamps are duplicated. Thankfully, the differences aren't big to matter in some applications, but it seems the way these timestamps are provided in the file do not work with `tz_localize`, which seems to be the tool to fix this problem.\r\n\r\n\r\n#### Code Sample\r\n\r\n```\r\nfrom pandas import Series, Timestamp\r\nSeries([14603.9, 14559.700000000001, 14239.0, 14371.0, 13914.5, 14427.200000000001, 14300.5, 14267.5, 14162.200000000001, 14148.5, 14028.1, 14083.1, 14122.9], index=[Timestamp('2015-10-25 01:30:00'), Timestamp('2015-10-25 01:45:00'), Timestamp('2015-10-25 02:00:00'), Timestamp('2015-10-25 02:00:00'), Timestamp('2015-10-25 02:15:00'), Timestamp('2015-10-25 02:15:00'), Timestamp('2015-10-25 02:30:00'), Timestamp('2015-10-25 02:30:00'), Timestamp('2015-10-25 02:45:00'), Timestamp('2015-10-25 02:45:00'), Timestamp('2015-10-25 03:00:00'), Timestamp('2015-10-25 03:15:00'), Timestamp('2015-10-25 03:30:00')]).tz_localize('Europe/Warsaw', ambiguous='infer')\r\n```\r\n\r\n#### Current Output\r\n\r\n```\r\n[…]\r\npandas/tslib.pyx in pandas.tslib.tz_localize_to_utc (pandas/tslib.c:69085)()\r\nAmbiguousTimeError: There are 4 dst switches when there should only be 1.\r\n```\r\n\r\n#### Expected Output\r\n\r\nObviously, we don't know what should be the exact result. My understanding of `ambiguous='infer'` is that at this point, I'm just letting `pandas` find some timezone assignment that is not totally wrong, because in some applications this will still be better than NaT. For example:\r\n\r\n```\r\n2015-10-25 01:30:00+02:00    14603.9\r\n2015-10-25 01:45:00+02:00    14559.7\r\n2015-10-25 02:00:00+02:00    14239.0\r\n2015-10-25 02:00:00+01:00    14371.0\r\n2015-10-25 02:15:00+02:00    13914.5\r\n2015-10-25 02:15:00+01:00    14427.2\r\n2015-10-25 02:30:00+02:00    14300.5\r\n2015-10-25 02:30:00+01:00    14267.5\r\n2015-10-25 02:45:00+02:00    14162.2\r\n2015-10-25 02:45:00+01:00    14148.5\r\n2015-10-25 03:00:00+01:00    14028.1\r\n2015-10-25 03:15:00+01:00    14083.1\r\n2015-10-25 03:30:00+01:00    14122.9\r\ndtype: float64\r\n```\r\n\r\n#### output of ``pd.show_versions()``\r\n\r\n```\r\nIn [4]: pandas.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: 4.6.0-0.bpo.1-amd64\r\nmachine: x86_64\r\nprocessor: \r\nbyteorder: little\r\nLC_ALL: None\r\nLANG: en_US.utf8\r\n\r\npandas: 0.18.1\r\nnose: None\r\npip: 1.5.6\r\nsetuptools: 24.0.3\r\nCython: 0.24.1\r\nnumpy: 1.11.1\r\nscipy: 0.17.1\r\nstatsmodels: None\r\nxarray: None\r\nIPython: 5.0.0\r\nsphinx: None\r\npatsy: None\r\ndateutil: 2.5.3\r\npytz: 2016.6.1\r\nblosc: None\r\nbottleneck: None\r\ntables: None\r\nnumexpr: None\r\nmatplotlib: 1.5.1\r\nopenpyxl: None\r\nxlrd: None\r\nxlwt: None\r\nxlsxwriter: None\r\nlxml: None\r\nbs4: None\r\nhtml5lib: 0.999\r\nhttplib2: None\r\napiclient: None\r\nsqlalchemy: None\r\npymysql: None\r\npsycopg2: None\r\njinja2: 2.8\r\nboto: None\r\npandas_datareader: None\r\n\r\n```"},"comment":{"url":"https://api.github.com/repos/pydata/pandas/issues/comments/238865546","html_url":"https://github.com/pydata/pandas/issues/13956#issuecomment-238865546","issue_url":"https://api.github.com/repos/pydata/pandas/issues/13956","id":238865546,"user":{"login":"rockg","id":3195015,"avatar_url":"https://avatars.githubusercontent.com/u/3195015?v=3","gravatar_id":"","url":"https://api.github.com/users/rockg","html_url":"https://github.com/rockg","followers_url":"https://api.github.com/users/rockg/followers","following_url":"https://api.github.com/users/rockg/following{/other_user}","gists_url":"https://api.github.com/users/rockg/gists{/gist_id}","starred_url":"https://api.github.com/users/rockg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rockg/subscriptions","organizations_url":"https://api.github.com/users/rockg/orgs","repos_url":"https://api.github.com/users/rockg/repos","events_url":"https://api.github.com/users/rockg/events{/privacy}","received_events_url":"https://api.github.com/users/rockg/received_events","type":"User","site_admin":false},"created_at":"2016-08-10T13:25:51Z","updated_at":"2016-08-10T13:25:51Z","body":"If this data getting sorted at any point by your code?  It seems to me that it should be presented in the below way as this how it came in sequentially and then localizing will work using `infer`.  I had a similar issue with some electricity pricing data and notified the data provider and they were able to fix in subsequent years.  If it's like the below, then it will work fine.\r\n\r\n```\r\n2015-10-25 01:30:00    14603.9\r\n2015-10-25 01:45:00    14559.7\r\n2015-10-25 02:00:00    14239.0\r\n2015-10-25 02:15:00    13914.5\r\n2015-10-25 02:30:00    14300.5\r\n2015-10-25 02:45:00    14162.2\r\n2015-10-25 02:00:00    14371.0\r\n2015-10-25 02:15:00    14427.2\r\n2015-10-25 02:30:00    14267.5\r\n2015-10-25 02:45:00    14148.5\r\n2015-10-25 03:00:00    14028.1\r\n2015-10-25 03:15:00    14083.1\r\n2015-10-25 03:30:00    14122.9\r\ndtype: float64\r\n```"}}
{"actor":{"display_login":"rockg"}}