{"action":"created","issue":{"url":"https://api.github.com/repos/pydata/pandas/issues/9970","labels_url":"https://api.github.com/repos/pydata/pandas/issues/9970/labels{/name}","comments_url":"https://api.github.com/repos/pydata/pandas/issues/9970/comments","events_url":"https://api.github.com/repos/pydata/pandas/issues/9970/events","html_url":"https://github.com/pydata/pandas/issues/9970","id":70218207,"number":9970,"title":"Value error on groupby bfill()","user":{"login":"arijun","id":4633429,"avatar_url":"https://avatars.githubusercontent.com/u/4633429?v=3","gravatar_id":"","url":"https://api.github.com/users/arijun","html_url":"https://github.com/arijun","followers_url":"https://api.github.com/users/arijun/followers","following_url":"https://api.github.com/users/arijun/following{/other_user}","gists_url":"https://api.github.com/users/arijun/gists{/gist_id}","starred_url":"https://api.github.com/users/arijun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arijun/subscriptions","organizations_url":"https://api.github.com/users/arijun/orgs","repos_url":"https://api.github.com/users/arijun/repos","events_url":"https://api.github.com/users/arijun/events{/privacy}","received_events_url":"https://api.github.com/users/arijun/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-04-22T19:47:10Z","updated_at":"2015-04-30T10:16:44Z","closed_at":null,"body":"I have a dataframe with a column containing some strings and NaNs. I can do do `df.col.bfill()` but when I try to do `df.groupby('col2').col1.bfill()` I get a `ValueError`.\r\nI can do `first` and `apply(lambda x: x is str)` without error.\r\n\r\nHere is the full traceback:\r\n\r\n```\r\nTraceback (most recent call last):\r\n  File \"C:\\Anaconda3\\lib\\site-packages\\pandas\\core\\groupby.py\", line 558, in wrapper\r\n    return self.apply(curried_with_axis)\r\n  File \"C:\\Anaconda3\\lib\\site-packages\\pandas\\core\\groupby.py\", line 662, in apply\r\n    return self._python_apply_general(f)\r\n  File \"C:\\Anaconda3\\lib\\site-packages\\pandas\\core\\groupby.py\", line 669, in _python_apply_general\r\n    not_indexed_same=mutated)\r\n  File \"C:\\Anaconda3\\lib\\site-packages\\pandas\\core\\groupby.py\", line 2380, in _wrap_applied_output\r\n    not_indexed_same=not_indexed_same)\r\n  File \"C:\\Anaconda3\\lib\\site-packages\\pandas\\core\\groupby.py\", line 1142, in _concat_objects\r\n    result = result.reindex(ax)\r\n  File \"C:\\Anaconda3\\lib\\site-packages\\pandas\\core\\series.py\", line 2149, in reindex\r\n    return super(Series, self).reindex(index=index, **kwargs)\r\n  File \"C:\\Anaconda3\\lib\\site-packages\\pandas\\core\\generic.py\", line 1731, in reindex\r\n    method, fill_value, copy).__finalize__(self)\r\n  File \"C:\\Anaconda3\\lib\\site-packages\\pandas\\core\\generic.py\", line 1749, in _reindex_axes\r\n    allow_dups=False)\r\n  File \"C:\\Anaconda3\\lib\\site-packages\\pandas\\core\\generic.py\", line 1834, in _reindex_with_indexers\r\n    copy=copy)\r\n  File \"C:\\Anaconda3\\lib\\site-packages\\pandas\\core\\internals.py\", line 3150, in reindex_indexer\r\n    raise ValueError(\"cannot reindex from a duplicate axis\")\r\nValueError: cannot reindex from a duplicate axis\r\n\r\nDuring handling of the above exception, another exception occurred:\r\n\r\nTraceback (most recent call last):\r\n  File \"C:\\Anaconda3\\lib\\site-packages\\pandas\\core\\groupby.py\", line 561, in wrapper\r\n    return self.apply(curried)\r\n  File \"C:\\Anaconda3\\lib\\site-packages\\pandas\\core\\groupby.py\", line 662, in apply\r\n    return self._python_apply_general(f)\r\n  File \"C:\\Anaconda3\\lib\\site-packages\\pandas\\core\\groupby.py\", line 669, in _python_apply_general\r\n    not_indexed_same=mutated)\r\n  File \"C:\\Anaconda3\\lib\\site-packages\\pandas\\core\\groupby.py\", line 2380, in _wrap_applied_output\r\n    not_indexed_same=not_indexed_same)\r\n  File \"C:\\Anaconda3\\lib\\site-packages\\pandas\\core\\groupby.py\", line 1142, in _concat_objects\r\n    result = result.reindex(ax)\r\n  File \"C:\\Anaconda3\\lib\\site-packages\\pandas\\core\\series.py\", line 2149, in reindex\r\n    return super(Series, self).reindex(index=index, **kwargs)\r\n  File \"C:\\Anaconda3\\lib\\site-packages\\pandas\\core\\generic.py\", line 1731, in reindex\r\n    method, fill_value, copy).__finalize__(self)\r\n  File \"C:\\Anaconda3\\lib\\site-packages\\pandas\\core\\generic.py\", line 1749, in _reindex_axes\r\n    allow_dups=False)\r\n  File \"C:\\Anaconda3\\lib\\site-packages\\pandas\\core\\generic.py\", line 1834, in _reindex_with_indexers\r\n    copy=copy)\r\n  File \"C:\\Anaconda3\\lib\\site-packages\\pandas\\core\\internals.py\", line 3150, in reindex_indexer\r\n    raise ValueError(\"cannot reindex from a duplicate axis\")\r\nValueError: cannot reindex from a duplicate axis\r\n\r\nDuring handling of the above exception, another exception occurred:\r\n\r\nTraceback (most recent call last):\r\n  File \"C:\\Anaconda3\\lib\\site-packages\\pandas\\core\\groupby.py\", line 570, in wrapper\r\n    return self._aggregate_item_by_item(name, *args, **kwargs)\r\n  File \"C:\\Anaconda3\\lib\\site-packages\\pandas\\core\\groupby.py\", line 511, in __getattr__\r\n    (type(self).__name__, attr))\r\nAttributeError: 'SeriesGroupBy' object has no attribute '_aggregate_item_by_item'\r\n\r\nDuring handling of the above exception, another exception occurred:\r\n\r\nTraceback (most recent call last):\r\n  File \"C:\\Program Files (x86)\\JetBrains\\PyCharm 3.4.1\\helpers\\pydev\\pydevd.py\", line 1733, in <module>\r\n    debugger.run(setup['file'], None, None)\r\n  File \"C:\\Program Files (x86)\\JetBrains\\PyCharm 3.4.1\\helpers\\pydev\\pydevd.py\", line 1226, in run\r\n    pydev_imports.execfile(file, globals, locals)  # execute the script\r\n  File \"C:\\Program Files (x86)\\JetBrains\\PyCharm 3.4.1\\helpers\\pydev\\_pydev_execfile.py\", line 38, in execfile\r\n    exec(compile(contents+\"\\n\", file, 'exec'), glob, loc) #execute the script\r\n  File \"G:/Users/ari/Documents/Git/Misc/testbross.py\", line 5, in <module>\r\n    brwbt = KevinsDB.KevinToWBT(brdb.both[brdb.both.SYMBOL=='VCLT'])\r\n  File \"G:\\Users\\ari\\Documents\\Git\\KevinsDB.py\", line 95, in KevinToWBT\r\n    s = grp.OrderTime.ffill().bfill()\r\n  File \"C:\\Anaconda3\\lib\\site-packages\\pandas\\core\\groupby.py\", line 572, in wrapper\r\n    raise ValueError\r\nValueError\r\n```"},"comment":{"url":"https://api.github.com/repos/pydata/pandas/issues/comments/97728898","html_url":"https://github.com/pydata/pandas/issues/9970#issuecomment-97728898","issue_url":"https://api.github.com/repos/pydata/pandas/issues/9970","id":97728898,"user":{"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},"created_at":"2015-04-30T10:16:44Z","updated_at":"2015-04-30T10:16:44Z","body":"can you show a reproducible example and ``pd.show_versions()``"}}