{"action":"created","issue":{"url":"https://api.github.com/repos/pandas-dev/pandas/issues/24151","repository_url":"https://api.github.com/repos/pandas-dev/pandas","labels_url":"https://api.github.com/repos/pandas-dev/pandas/issues/24151/labels{/name}","comments_url":"https://api.github.com/repos/pandas-dev/pandas/issues/24151/comments","events_url":"https://api.github.com/repos/pandas-dev/pandas/issues/24151/events","html_url":"https://github.com/pandas-dev/pandas/issues/24151","id":388817439,"node_id":"MDU6SXNzdWUzODg4MTc0Mzk=","number":24151,"title":"Inside rolling apply idxmax and idxmin on Datetime Index do not work as expected","user":{"login":"dimitar-petrov","id":4025446,"node_id":"MDQ6VXNlcjQwMjU0NDY=","avatar_url":"https://avatars2.githubusercontent.com/u/4025446?v=4","gravatar_id":"","url":"https://api.github.com/users/dimitar-petrov","html_url":"https://github.com/dimitar-petrov","followers_url":"https://api.github.com/users/dimitar-petrov/followers","following_url":"https://api.github.com/users/dimitar-petrov/following{/other_user}","gists_url":"https://api.github.com/users/dimitar-petrov/gists{/gist_id}","starred_url":"https://api.github.com/users/dimitar-petrov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dimitar-petrov/subscriptions","organizations_url":"https://api.github.com/users/dimitar-petrov/orgs","repos_url":"https://api.github.com/users/dimitar-petrov/repos","events_url":"https://api.github.com/users/dimitar-petrov/events{/privacy}","received_events_url":"https://api.github.com/users/dimitar-petrov/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-12-07T21:18:38Z","updated_at":"2018-12-07T21:59:42Z","closed_at":null,"author_association":"NONE","body":"#### Code Sample, a copy-pastable example if possible\r\n\r\n```python\r\nipdb> df\r\ntimestamp\r\n2018-07-01 00:01:25.746187    6399.5\r\n2018-07-01 00:01:26.349274    6400.0\r\n2018-07-01 00:01:26.746187    6401.5\r\n2018-07-01 00:01:27.319575    6399.5\r\n2018-07-01 00:01:29.679575    6393.0\r\ndtype: float64\r\nipdb> df.index\r\nDatetimeIndex(['2018-07-01 00:01:25.746187', '2018-07-01 00:01:26.349274',\r\n               '2018-07-01 00:01:26.746187', '2018-07-01 00:01:27.319575',\r\n               '2018-07-01 00:01:29.679575'],\r\n              dtype='datetime64[ns]', name='timestamp', freq=None)\r\nipdb> df.index.is_monotonic_increasing\r\nTrue\r\nipdb> df.idxmin()\r\nTimestamp('2018-07-01 00:01:29.679575')\r\nipdb> df.idxmax()\r\nTimestamp('2018-07-01 00:01:26.746187')\r\nipdb> df.reset_index()\r\n                   timestamp       0\r\n0 2018-07-01 00:01:25.746187  6399.5\r\n1 2018-07-01 00:01:26.349274  6400.0\r\n2 2018-07-01 00:01:26.746187  6401.5\r\n3 2018-07-01 00:01:27.319575  6399.5\r\n4 2018-07-01 00:01:29.679575  6393.0\r\nipdb> \r\n```\r\n#### Problem description\r\n\r\nUsing rolling apply with timedelta offset, starts breaking idxmin and idxmax unexpectedly by returning the opposite value.\r\nCould not isolate simple example but I am able to put a BP and investigate the state of the live objects.\r\n\r\n#### Expected Output\r\n\r\n#### Output of ``pd.show_versions()``\r\n\r\n<details>\r\n\r\n[paste the output of ``pd.show_versions()`` here below this line]\r\nipdb> pd.show_versions()\r\n\r\nINSTALLED VERSIONS\r\n------------------\r\ncommit: None\r\npython: 3.6.6.final.0\r\npython-bits: 64\r\nOS: Linux\r\nOS-release: 4.18.16-arch1-1-ARCH\r\nmachine: x86_64\r\nprocessor: \r\nbyteorder: little\r\nLC_ALL: None\r\nLANG: en_US.UTF-8\r\nLOCALE: en_US.UTF-8\r\n\r\npandas: 0.23.4\r\npytest: 4.0.0\r\npip: 18.1\r\nsetuptools: 40.6.2\r\nCython: None\r\nnumpy: 1.15.4\r\nscipy: 1.1.0\r\npyarrow: 0.11.1\r\nxarray: 0.11.0\r\nIPython: 7.1.1\r\nsphinx: 1.8.2\r\npatsy: 0.5.1\r\ndateutil: 2.7.5\r\npytz: 2018.7\r\nblosc: 1.6.2\r\nbottleneck: 1.2.1\r\ntables: 3.4.4\r\nnumexpr: 2.6.8\r\nfeather: None\r\nmatplotlib: 3.0.2\r\nopenpyxl: None\r\nxlrd: None\r\nxlwt: None\r\nxlsxwriter: None\r\nlxml: None\r\nbs4: None\r\nhtml5lib: None\r\nsqlalchemy: None\r\npymysql: None\r\npsycopg2: None\r\njinja2: 2.10\r\ns3fs: None\r\nfastparquet: 0.1.6\r\npandas_gbq: None\r\npandas_datareader: 0.7.0\r\n\r\n</details>\r\n"},"comment":{"url":"https://api.github.com/repos/pandas-dev/pandas/issues/comments/445379006","html_url":"https://github.com/pandas-dev/pandas/issues/24151#issuecomment-445379006","issue_url":"https://api.github.com/repos/pandas-dev/pandas/issues/24151","id":445379006,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0NTM3OTAwNg==","user":{"login":"TomAugspurger","id":1312546,"node_id":"MDQ6VXNlcjEzMTI1NDY=","avatar_url":"https://avatars3.githubusercontent.com/u/1312546?v=4","gravatar_id":"","url":"https://api.github.com/users/TomAugspurger","html_url":"https://github.com/TomAugspurger","followers_url":"https://api.github.com/users/TomAugspurger/followers","following_url":"https://api.github.com/users/TomAugspurger/following{/other_user}","gists_url":"https://api.github.com/users/TomAugspurger/gists{/gist_id}","starred_url":"https://api.github.com/users/TomAugspurger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TomAugspurger/subscriptions","organizations_url":"https://api.github.com/users/TomAugspurger/orgs","repos_url":"https://api.github.com/users/TomAugspurger/repos","events_url":"https://api.github.com/users/TomAugspurger/events{/privacy}","received_events_url":"https://api.github.com/users/TomAugspurger/received_events","type":"User","site_admin":false},"created_at":"2018-12-07T21:59:42Z","updated_at":"2018-12-07T21:59:42Z","author_association":"CONTRIBUTOR","body":"Can you reproduce this outside of rolling?\r\n\r\n```python\r\nIn [16]: index = DatetimeIndex(['2018-07-01 00:01:25.746187', '2018-07-01 00:01:26.349274',\r\n    ...:                '2018-07-01 00:01:26.746187', '2018-07-01 00:01:27.319575',\r\n    ...:                '2018-07-01 00:01:29.679575'],\r\n    ...:               dtype='datetime64[ns]', name='timestamp', freq=None)\r\n    ...: s = pd.Series(1, index=index)\r\n\r\nIn [17]: s.idxmin()\r\nOut[17]: Timestamp('2018-07-01 00:01:25.746187')\r\n\r\n```\r\n\r\nlooks fine on master."}}
{"actor":{"display_login":"TomAugspurger"}}