{"action":"opened","issue":{"url":"https://api.github.com/repos/pydata/pandas/issues/9214","labels_url":"https://api.github.com/repos/pydata/pandas/issues/9214/labels{/name}","comments_url":"https://api.github.com/repos/pydata/pandas/issues/9214/comments","events_url":"https://api.github.com/repos/pydata/pandas/issues/9214/events","html_url":"https://github.com/pydata/pandas/issues/9214","id":53813014,"number":9214,"title":"BUG/ENH: groupby head returns empty result for negative n","user":{"login":"TomAugspurger","id":1312546,"avatar_url":"https://avatars.githubusercontent.com/u/1312546?v=3","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},"labels":[{"url":"https://api.github.com/repos/pydata/pandas/labels/API+Design","name":"API Design","color":"AD7FA8"},{"url":"https://api.github.com/repos/pydata/pandas/labels/Bug","name":"Bug","color":"e10c02"},{"url":"https://api.github.com/repos/pydata/pandas/labels/Groupby","name":"Groupby","color":"729FCF"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-01-08T23:02:53Z","updated_at":"2015-01-08T23:02:53Z","closed_at":null,"body":"More drive-by reports. I'll try to close some of these issues sometime...\r\n\r\n```python\r\nIn [8]: s = pd.Series(np.random.randn(10))\r\n\r\nIn [9]: s.groupby(s > 0).apply(lambda x: x.head(-1))\r\nOut[9]:\r\nFalse  0   -0.277400\r\n       1   -0.875231\r\n       3   -0.315087\r\n       4   -0.966649\r\n       6   -0.474389\r\n       7   -0.121225\r\nTrue   2    0.237861\r\n       5    1.311601\r\ndtype: float64\r\n\r\nIn [10]: s.groupby(s > 0).head(-1)\r\nOut[10]: Series([], dtype: float64)\r\n\r\n```"}}