Backport PR #27827 on branch 0.25.x (BUG: Fixed groupby quantile for listlike q)
Backport PR #27827: BUG: Fixed groupby quantile for listlike q
Just codecov. The merge build should pass.  @TomAugspurger I just tested this on Pandas 0.25.1 pip build Windows x64 Python 3.7.1

```python
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
``` That's unfortunate. Can you open a new issue with that example?

On Thu, Aug 22, 2019 at 3:35 PM Gagi <notifications@github.com> wrote:

> @TomAugspurger <https://github.com/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
> ```
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <https://github.com/pandas-dev/pandas/pull/28085?email_source=notifications&email_token=AAKAOISRDWE5GGABDXHRDB3QF32ANA5CNFSM4IOT44DKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD46KBDY#issuecomment-524066959>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AAKAOIT647ECNE2FSYQ4CNDQF32ANANCNFSM4IOT44DA>
> .
>
 nvm, I think I have a fix.

On Fri, Aug 23, 2019 at 8:28 AM Tom Augspurger <tom.augspurger88@gmail.com>
wrote:

> That's unfortunate. Can you open a new issue with that example?
>
> On Thu, Aug 22, 2019 at 3:35 PM Gagi <notifications@github.com> wrote:
>
>> @TomAugspurger <https://github.com/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
>> ```
>>
>> —
>> You are receiving this because you were mentioned.
>> Reply to this email directly, view it on GitHub
>> <https://github.com/pandas-dev/pandas/pull/28085?email_source=notifications&email_token=AAKAOISRDWE5GGABDXHRDB3QF32ANA5CNFSM4IOT44DKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD46KBDY#issuecomment-524066959>,
>> or mute the thread
>> <https://github.com/notifications/unsubscribe-auth/AAKAOIT647ECNE2FSYQ4CNDQF32ANANCNFSM4IOT44DA>
>> .
>>
>
