Skip to content

Backport PR #27827 on branch 0.25.x (BUG: Fixed groupby quantile for listlike q) #28085

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

meeseeksmachine
Copy link
Contributor

Backport PR #27827: BUG: Fixed groupby quantile for listlike q

@lumberbot-app lumberbot-app bot added this to the 0.25.1 milestone Aug 22, 2019
@TomAugspurger
Copy link
Contributor

Just codecov. The merge build should pass.

@TomAugspurger TomAugspurger merged commit 91aa2f5 into pandas-dev:0.25.x Aug 22, 2019
@dragoljub
Copy link

@TomAugspurger I just tested this on Pandas 0.25.1 pip build Windows x64 Python 3.7.1

df = pd.DataFrame(np.random.randint(0,5, size=(10,3)), columns=list('ABC'))
df.groupby('A').quantile([.3,.7])
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-16-f3668ef567ee> in <module>
----> 1 df3.groupby('A').quantile([.3,.7])

c:\python37\lib\site-packages\pandas\core\groupby\groupby.py in quantile(self, q, interpolation)
   1951             indices = np.concatenate(arrays)
   1952             assert len(indices) == len(result)
-> 1953             return result.take(indices)
   1954 
   1955     @Substitution(name="groupby")

c:\python37\lib\site-packages\pandas\core\generic.py in take(self, indices, axis, is_copy, **kwargs)
   3602 
   3603         new_data = self._data.take(
-> 3604             indices, axis=self._get_block_manager_axis(axis), verify=True
   3605         )
   3606         result = self._constructor(new_data).__finalize__(self)

c:\python37\lib\site-packages\pandas\core\internals\managers.py in take(self, indexer, axis, verify, convert)
   1387         n = self.shape[axis]
   1388         if convert:
-> 1389             indexer = maybe_convert_indices(indexer, n)
   1390 
   1391         if verify:

c:\python37\lib\site-packages\pandas\core\indexers.py in maybe_convert_indices(indices, n)
    199     mask = (indices >= n) | (indices < 0)
    200     if mask.any():
--> 201         raise IndexError("indices are out-of-bounds")
    202     return indices
    203 

IndexError: indices are out-of-bounds
```

@TomAugspurger
Copy link
Contributor

TomAugspurger commented Aug 23, 2019 via email

@TomAugspurger
Copy link
Contributor

TomAugspurger commented Aug 23, 2019 via email

TomAugspurger added a commit to TomAugspurger/pandas that referenced this pull request Aug 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants