<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="
import pandas as pd
import numpy as np

df = pd.DataFrame({'a': np.random.randint(0, 100, 10)})
df['b'] = pd.cut(df['a'], np.arange(0, 110, 10))
pd.merge(df, df, on='b')
"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">pandas</span> <span class="pl-k">as</span> <span class="pl-s1">pd</span>
<span class="pl-k">import</span> <span class="pl-s1">numpy</span> <span class="pl-k">as</span> <span class="pl-s1">np</span>

<span class="pl-s1">df</span> <span class="pl-c1">=</span> <span class="pl-s1">pd</span>.<span class="pl-v">DataFrame</span>({<span class="pl-s">'a'</span>: <span class="pl-s1">np</span>.<span class="pl-s1">random</span>.<span class="pl-en">randint</span>(<span class="pl-c1">0</span>, <span class="pl-c1">100</span>, <span class="pl-c1">10</span>)})
<span class="pl-s1">df</span>[<span class="pl-s">'b'</span>] <span class="pl-c1">=</span> <span class="pl-s1">pd</span>.<span class="pl-en">cut</span>(<span class="pl-s1">df</span>[<span class="pl-s">'a'</span>], <span class="pl-s1">np</span>.<span class="pl-en">arange</span>(<span class="pl-c1">0</span>, <span class="pl-c1">110</span>, <span class="pl-c1">10</span>))
<span class="pl-s1">pd</span>.<span class="pl-en">merge</span>(<span class="pl-s1">df</span>, <span class="pl-s1">df</span>, <span class="pl-s1">on</span><span class="pl-c1">=</span><span class="pl-s">'b'</span>)</pre></div>
<h4 dir="auto">Problem description</h4>
<p dir="auto">pd.merge(df, df, on='b')</p>
<p dir="auto">Out:<br>
a_x          b  a_y<br>
0    66   (60, 70]   66<br>
1    66   (60, 70]   68<br>
2    68   (60, 70]   66<br>
3    68   (60, 70]   68<br>
4    93  (90, 100]   93<br>
5    43   (40, 50]   43<br>
6    43   (40, 50]   43<br>
7    43   (40, 50]   43<br>
8    43   (40, 50]   43<br>
9    37   (30, 40]   37<br>
10   37   (30, 40]   35<br>
11   35   (30, 40]   37<br>
12   35   (30, 40]   35<br>
13    2    (0, 10]    2<br>
14    2    (0, 10]    4<br>
15    4    (0, 10]    2<br>
16    4    (0, 10]    4<br>
17   86   (80, 90]   86</p>
<p dir="auto">df</p>
<p dir="auto">Out:<br>
a          b<br>
0  66   (60, 70]<br>
1  93  (90, 100]<br>
2  43   (40, 50]<br>
3  37   (30, 40]<br>
4  68   (60, 70]<br>
5   2    (0, 10]<br>
6  43   (40, 50]<br>
7  86   (80, 90]<br>
8  35   (30, 40]<br>
9   4    (0, 10]</p>
<h4 dir="auto">Expected Output</h4>
<p dir="auto">merge result's len should be equal to df</p>
<h4 dir="auto">Output of <code class="notranslate">pd.show_versions()</code></h4>
<details>
<h2 dir="auto">INSTALLED VERSIONS</h2>
<p dir="auto">commit: None<br>
python: 3.6.4.final.0<br>
python-bits: 64<br>
OS: Darwin<br>
OS-release: 17.5.0<br>
machine: x86_64<br>
processor: i386<br>
byteorder: little<br>
LC_ALL: en_US.UTF-8<br>
LANG: en_US.UTF-8<br>
LOCALE: en_US.UTF-8</p>
<p dir="auto">pandas: 0.21.0<br>
pytest: None<br>
pip: 9.0.1<br>
setuptools: 28.8.0<br>
Cython: None<br>
numpy: 1.13.1<br>
scipy: 0.19.1<br>
pyarrow: None<br>
xarray: None<br>
IPython: 6.0.0<br>
sphinx: None<br>
patsy: None<br>
dateutil: 2.6.1<br>
pytz: 2017.3<br>
blosc: None<br>
bottleneck: None<br>
tables: None<br>
numexpr: None<br>
feather: None<br>
matplotlib: None<br>
openpyxl: None<br>
xlrd: None<br>
xlwt: None<br>
xlsxwriter: None<br>
lxml: None<br>
bs4: None<br>
html5lib: 0.999999999<br>
sqlalchemy: None<br>
pymysql: None<br>
psycopg2: None<br>
jinja2: 2.9.6<br>
s3fs: None<br>
fastparquet: None<br>
pandas_gbq: None<br>
pandas_datareader: None</p>
</details>
<p dir="auto"><code class="notranslate">pd.qcut</code> doesn't seem to support <code class="notranslate">ndarray</code> type. However, <a href="https://pandas.pydata.org/pandas-docs/stable/generated/pandas.qcut.html" rel="nofollow">docstrings</a> points <code class="notranslate">x : ndarray or Series</code></p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="In [46]: d = range(5)

In [47]: d
Out[47]: [0, 1, 2, 3, 4]

In [48]: pd.qcut(d, [0, 1])
Out[48]:
[(-0.001, 4.0], (-0.001, 4.0], (-0.001, 4.0], (-0.001, 4.0], (-0.001, 4.0]]
Categories (1, interval[float64]): [(-0.001, 4.0]]

In [49]: d = np.array(range(5))

In [50]: d
Out[50]: array([0, 1, 2, 3, 4])

In [51]: pd.qcut(d, [0, 1])
Out[51]:
[(-0.001, 4.0], (-0.001, 4.0], (-0.001, 4.0], (-0.001, 4.0], (-0.001, 4.0]]
Categories (1, interval[float64]): [(-0.001, 4.0]]

In [52]: d = np.array([[x] for x in range(5)])

In [53]: type(d)
Out[53]: numpy.ndarray

In [54]: d
Out[54]:
array([[0],
       [1],
       [2],
       [3],
       [4]])

In [55]: pd.qcut(d, [0, 1])
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
&lt;ipython-input-55-b172e74b0ffd&gt; in &lt;module&gt;()
----&gt; 1 pd.qcut(d, [0, 1])

e:\github\pandas\pandas\core\reshape\tile.pyc in qcut(x, q, labels, retbins, precision, duplicates)
    206     fac, bins = _bins_to_cuts(x, bins, labels=labels,
    207                               precision=precision, include_lowest=True,
--&gt; 208                               dtype=dtype, duplicates=duplicates)
    209
    210     return _postprocess_for_cut(fac, bins, retbins, x_is_series,

e:\github\pandas\pandas\core\reshape\tile.pyc in _bins_to_cuts(x, bins, right, labels, precision, include_lowest, dtype, duplicates)
    258
    259         np.putmask(ids, na_mask, 0)
--&gt; 260         result = algos.take_nd(labels, ids - 1)
    261
    262     else:

e:\github\pandas\pandas\core\algorithms.pyc in take_nd(arr, indexer, axis, out, fill_value, mask_info, allow_fill)
   1318     if is_categorical(arr):
   1319         return arr.take_nd(indexer, fill_value=fill_value,
-&gt; 1320                            allow_fill=allow_fill)
   1321     elif is_datetimetz(arr):
   1322         return arr.take(indexer, fill_value=fill_value, allow_fill=allow_fill)

e:\github\pandas\pandas\core\categorical.pyc in take_nd(self, indexer, allow_fill, fill_value)
   1703         assert isna(fill_value)
   1704
-&gt; 1705         codes = take_1d(self._codes, indexer, allow_fill=True, fill_value=-1)
   1706         result = self._constructor(codes, categories=self.categories,
   1707                                    ordered=self.ordered, fastpath=True)

e:\github\pandas\pandas\core\algorithms.pyc in take_nd(arr, indexer, axis, out, fill_value, mask_info, allow_fill)
   1381     func = _get_take_nd_function(arr.ndim, arr.dtype, out.dtype, axis=axis,
   1382                                  mask_info=mask_info)
-&gt; 1383     func(arr, indexer, out, fill_value)
   1384
   1385     if flip_order:

e:\github\pandas\pandas\_libs\algos_take_helper.pxi in pandas._libs.algos.take_1d_int8_int8 (pandas\_libs\algos.c:75951)()
    560 @cython.boundscheck(False)
    561 def take_1d_int8_int8(ndarray[int8_t, ndim=1] values,
--&gt; 562                               int64_t[:] indexer,
    563                               int8_t[:] out,
    564                               fill_value=np.nan):

ValueError: Buffer has wrong number of dimensions (expected 1, got 2)"><pre class="notranslate"><span class="pl-v">In</span> [<span class="pl-c1">46</span>]: <span class="pl-s1">d</span> <span class="pl-c1">=</span> <span class="pl-en">range</span>(<span class="pl-c1">5</span>)

<span class="pl-v">In</span> [<span class="pl-c1">47</span>]: <span class="pl-s1">d</span>
<span class="pl-v">Out</span>[<span class="pl-c1">47</span>]: [<span class="pl-c1">0</span>, <span class="pl-c1">1</span>, <span class="pl-c1">2</span>, <span class="pl-c1">3</span>, <span class="pl-c1">4</span>]

<span class="pl-v">In</span> [<span class="pl-c1">48</span>]: <span class="pl-s1">pd</span>.<span class="pl-en">qcut</span>(<span class="pl-s1">d</span>, [<span class="pl-c1">0</span>, <span class="pl-c1">1</span>])
<span class="pl-v">Out</span>[<span class="pl-c1">48</span>]:
[(<span class="pl-c1">-</span><span class="pl-c1">0.001</span>, <span class="pl-c1">4.0</span>], (<span class="pl-c1">-</span><span class="pl-c1">0.001</span>, <span class="pl-c1">4.0</span>], (<span class="pl-c1">-</span><span class="pl-c1">0.001</span>, <span class="pl-c1">4.0</span>], (<span class="pl-c1">-</span><span class="pl-c1">0.001</span>, <span class="pl-c1">4.0</span>], (<span class="pl-c1">-</span><span class="pl-c1">0.001</span>, <span class="pl-c1">4.0</span>]]
<span class="pl-v">Categories</span> (<span class="pl-c1">1</span>, <span class="pl-s1">interval</span>[<span class="pl-s1">float64</span>]): [(<span class="pl-c1">-</span><span class="pl-c1">0.001</span>, <span class="pl-c1">4.0</span>]]

<span class="pl-v">In</span> [<span class="pl-c1">49</span>]: <span class="pl-s1">d</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-en">array</span>(<span class="pl-en">range</span>(<span class="pl-c1">5</span>))

<span class="pl-v">In</span> [<span class="pl-c1">50</span>]: <span class="pl-s1">d</span>
<span class="pl-v">Out</span>[<span class="pl-c1">50</span>]: <span class="pl-en">array</span>([<span class="pl-c1">0</span>, <span class="pl-c1">1</span>, <span class="pl-c1">2</span>, <span class="pl-c1">3</span>, <span class="pl-c1">4</span>])

<span class="pl-v">In</span> [<span class="pl-c1">51</span>]: <span class="pl-s1">pd</span>.<span class="pl-en">qcut</span>(<span class="pl-s1">d</span>, [<span class="pl-c1">0</span>, <span class="pl-c1">1</span>])
<span class="pl-v">Out</span>[<span class="pl-c1">51</span>]:
[(<span class="pl-c1">-</span><span class="pl-c1">0.001</span>, <span class="pl-c1">4.0</span>], (<span class="pl-c1">-</span><span class="pl-c1">0.001</span>, <span class="pl-c1">4.0</span>], (<span class="pl-c1">-</span><span class="pl-c1">0.001</span>, <span class="pl-c1">4.0</span>], (<span class="pl-c1">-</span><span class="pl-c1">0.001</span>, <span class="pl-c1">4.0</span>], (<span class="pl-c1">-</span><span class="pl-c1">0.001</span>, <span class="pl-c1">4.0</span>]]
<span class="pl-v">Categories</span> (<span class="pl-c1">1</span>, <span class="pl-s1">interval</span>[<span class="pl-s1">float64</span>]): [(<span class="pl-c1">-</span><span class="pl-c1">0.001</span>, <span class="pl-c1">4.0</span>]]

<span class="pl-v">In</span> [<span class="pl-c1">52</span>]: <span class="pl-s1">d</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-en">array</span>([[<span class="pl-s1">x</span>] <span class="pl-k">for</span> <span class="pl-s1">x</span> <span class="pl-c1">in</span> <span class="pl-en">range</span>(<span class="pl-c1">5</span>)])

<span class="pl-v">In</span> [<span class="pl-c1">53</span>]: <span class="pl-en">type</span>(<span class="pl-s1">d</span>)
<span class="pl-v">Out</span>[<span class="pl-c1">53</span>]: <span class="pl-s1">numpy</span>.<span class="pl-s1">ndarray</span>

<span class="pl-v">In</span> [<span class="pl-c1">54</span>]: <span class="pl-s1">d</span>
<span class="pl-v">Out</span>[<span class="pl-c1">54</span>]:
<span class="pl-en">array</span>([[<span class="pl-c1">0</span>],
       [<span class="pl-c1">1</span>],
       [<span class="pl-c1">2</span>],
       [<span class="pl-c1">3</span>],
       [<span class="pl-c1">4</span>]])

<span class="pl-v">In</span> [<span class="pl-c1">55</span>]: <span class="pl-s1">pd</span>.<span class="pl-en">qcut</span>(<span class="pl-s1">d</span>, [<span class="pl-c1">0</span>, <span class="pl-c1">1</span>])
<span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span>
<span class="pl-v">ValueError</span>                                <span class="pl-v">Traceback</span> (<span class="pl-s1">most</span> <span class="pl-s1">recent</span> <span class="pl-s1">call</span> <span class="pl-s1">last</span>)
<span class="pl-c1">&lt;</span><span class="pl-s1">ipython</span><span class="pl-c1">-</span><span class="pl-s1">input</span><span class="pl-c1">-</span><span class="pl-c1">55</span><span class="pl-c1">-</span><span class="pl-s1">b172e74b0ffd</span><span class="pl-c1">&gt;</span> <span class="pl-s1">in</span> <span class="pl-c1">&lt;</span><span class="pl-s1">module</span><span class="pl-c1">&gt;</span>()
<span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">1</span> <span class="pl-s1">pd</span>.<span class="pl-en">qcut</span>(<span class="pl-s1">d</span>, [<span class="pl-c1">0</span>, <span class="pl-c1">1</span>])

<span class="pl-s1">e</span>:\g<span class="pl-s1">ithub</span>\p<span class="pl-s1">andas</span>\p<span class="pl-s1">andas</span>\c<span class="pl-s1">ore</span>\r<span class="pl-s1">eshape</span>\t<span class="pl-s1">ile</span>.<span class="pl-s1">pyc</span> <span class="pl-c1">in</span> <span class="pl-en">qcut</span>(<span class="pl-s1">x</span>, <span class="pl-s1">q</span>, <span class="pl-s1">labels</span>, <span class="pl-s1">retbins</span>, <span class="pl-s1">precision</span>, <span class="pl-s1">duplicates</span>)
    <span class="pl-c1">206</span>     <span class="pl-s1">fac</span>, <span class="pl-s1">bins</span> <span class="pl-c1">=</span> <span class="pl-en">_bins_to_cuts</span>(<span class="pl-s1">x</span>, <span class="pl-s1">bins</span>, <span class="pl-s1">labels</span><span class="pl-c1">=</span><span class="pl-s1">labels</span>,
    <span class="pl-c1">207</span>                               <span class="pl-s1">precision</span><span class="pl-c1">=</span><span class="pl-s1">precision</span>, <span class="pl-s1">include_lowest</span><span class="pl-c1">=</span><span class="pl-c1">True</span>,
<span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">208</span>                               <span class="pl-s1">dtype</span><span class="pl-c1">=</span><span class="pl-s1">dtype</span>, <span class="pl-s1">duplicates</span><span class="pl-c1">=</span><span class="pl-s1">duplicates</span>)
    <span class="pl-c1">209</span>
    <span class="pl-c1">210</span>     <span class="pl-s1">return</span> <span class="pl-s1">_postprocess_for_cut</span>(<span class="pl-s1">fac</span>, <span class="pl-s1">bins</span>, <span class="pl-s1">retbins</span>, <span class="pl-s1">x_is_series</span>,

<span class="pl-s1">e</span>:\g<span class="pl-s1">ithub</span>\p<span class="pl-s1">andas</span>\p<span class="pl-s1">andas</span>\c<span class="pl-s1">ore</span>\r<span class="pl-s1">eshape</span>\t<span class="pl-s1">ile</span>.<span class="pl-s1">pyc</span> <span class="pl-c1">in</span> <span class="pl-en">_bins_to_cuts</span>(<span class="pl-s1">x</span>, <span class="pl-s1">bins</span>, <span class="pl-s1">right</span>, <span class="pl-s1">labels</span>, <span class="pl-s1">precision</span>, <span class="pl-s1">include_lowest</span>, <span class="pl-s1">dtype</span>, <span class="pl-s1">duplicates</span>)
    <span class="pl-c1">258</span>
    <span class="pl-c1">259</span>         <span class="pl-s1">np</span>.<span class="pl-en">putmask</span>(<span class="pl-s1">ids</span>, <span class="pl-s1">na_mask</span>, <span class="pl-c1">0</span>)
<span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">260</span>         <span class="pl-s1">result</span> <span class="pl-c1">=</span> <span class="pl-s1">algos</span>.<span class="pl-en">take_nd</span>(<span class="pl-s1">labels</span>, <span class="pl-s1">ids</span> <span class="pl-c1">-</span> <span class="pl-c1">1</span>)
    <span class="pl-c1">261</span>
    <span class="pl-c1">262</span>     <span class="pl-k">else</span>:

<span class="pl-s1">e</span>:\g<span class="pl-s1">ithub</span>\p<span class="pl-s1">andas</span>\p<span class="pl-s1">andas</span>\c<span class="pl-s1">ore</span>\a<span class="pl-s1">lgorithms</span>.<span class="pl-s1">pyc</span> <span class="pl-c1">in</span> <span class="pl-en">take_nd</span>(<span class="pl-s1">arr</span>, <span class="pl-s1">indexer</span>, <span class="pl-s1">axis</span>, <span class="pl-s1">out</span>, <span class="pl-s1">fill_value</span>, <span class="pl-s1">mask_info</span>, <span class="pl-s1">allow_fill</span>)
   <span class="pl-c1">1318</span>     <span class="pl-k">if</span> <span class="pl-en">is_categorical</span>(<span class="pl-s1">arr</span>):
   <span class="pl-c1">1319</span>         <span class="pl-s1">return</span> <span class="pl-s1">arr</span>.<span class="pl-en">take_nd</span>(<span class="pl-s1">indexer</span>, <span class="pl-s1">fill_value</span><span class="pl-c1">=</span><span class="pl-s1">fill_value</span>,
<span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">1320</span>                            <span class="pl-s1">allow_fill</span><span class="pl-c1">=</span><span class="pl-s1">allow_fill</span>)
   <span class="pl-c1">1321</span>     <span class="pl-k">elif</span> <span class="pl-en">is_datetimetz</span>(<span class="pl-s1">arr</span>):
   <span class="pl-c1">1322</span>         <span class="pl-s1">return</span> <span class="pl-s1">arr</span>.<span class="pl-en">take</span>(<span class="pl-s1">indexer</span>, <span class="pl-s1">fill_value</span><span class="pl-c1">=</span><span class="pl-s1">fill_value</span>, <span class="pl-s1">allow_fill</span><span class="pl-c1">=</span><span class="pl-s1">allow_fill</span>)

<span class="pl-s1">e</span>:\g<span class="pl-s1">ithub</span>\p<span class="pl-s1">andas</span>\p<span class="pl-s1">andas</span>\c<span class="pl-s1">ore</span>\c<span class="pl-s1">ategorical</span>.<span class="pl-s1">pyc</span> <span class="pl-c1">in</span> <span class="pl-en">take_nd</span>(<span class="pl-s1">self</span>, <span class="pl-s1">indexer</span>, <span class="pl-s1">allow_fill</span>, <span class="pl-s1">fill_value</span>)
   <span class="pl-c1">1703</span>         <span class="pl-k">assert</span> <span class="pl-s1">isna</span>(<span class="pl-s1">fill_value</span>)
   <span class="pl-c1">1704</span>
<span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">1705</span>         <span class="pl-s1">codes</span> <span class="pl-c1">=</span> <span class="pl-s1">take_1d</span>(<span class="pl-s1">self</span>.<span class="pl-s1">_codes</span>, <span class="pl-s1">indexer</span>, <span class="pl-s1">allow_fill</span><span class="pl-c1">=</span><span class="pl-c1">True</span>, <span class="pl-s1">fill_value</span><span class="pl-c1">=</span><span class="pl-c1">-</span><span class="pl-c1">1</span>)
   <span class="pl-c1">1706</span>         <span class="pl-s1">result</span> <span class="pl-c1">=</span> <span class="pl-s1">self</span>.<span class="pl-en">_constructor</span>(<span class="pl-s1">codes</span>, <span class="pl-s1">categories</span><span class="pl-c1">=</span><span class="pl-s1">self</span>.<span class="pl-s1">categories</span>,
   <span class="pl-c1">1707</span>                                    <span class="pl-s1">ordered</span><span class="pl-c1">=</span><span class="pl-s1">self</span>.<span class="pl-s1">ordered</span>, <span class="pl-s1">fastpath</span><span class="pl-c1">=</span><span class="pl-c1">True</span>)

<span class="pl-s1">e</span>:\g<span class="pl-s1">ithub</span>\p<span class="pl-s1">andas</span>\p<span class="pl-s1">andas</span>\c<span class="pl-s1">ore</span>\a<span class="pl-s1">lgorithms</span>.<span class="pl-s1">pyc</span> <span class="pl-c1">in</span> <span class="pl-en">take_nd</span>(<span class="pl-s1">arr</span>, <span class="pl-s1">indexer</span>, <span class="pl-s1">axis</span>, <span class="pl-s1">out</span>, <span class="pl-s1">fill_value</span>, <span class="pl-s1">mask_info</span>, <span class="pl-s1">allow_fill</span>)
   <span class="pl-c1">1381</span>     <span class="pl-s1">func</span> <span class="pl-c1">=</span> <span class="pl-s1">_get_take_nd_function</span>(<span class="pl-s1">arr</span>.<span class="pl-s1">ndim</span>, <span class="pl-s1">arr</span>.<span class="pl-s1">dtype</span>, <span class="pl-s1">out</span>.<span class="pl-s1">dtype</span>, <span class="pl-s1">axis</span><span class="pl-c1">=</span><span class="pl-s1">axis</span>,
   <span class="pl-c1">1382</span>                                  <span class="pl-s1">mask_info</span><span class="pl-c1">=</span><span class="pl-s1">mask_info</span>)
<span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">1383</span>     <span class="pl-en">func</span>(<span class="pl-s1">arr</span>, <span class="pl-s1">indexer</span>, <span class="pl-s1">out</span>, <span class="pl-s1">fill_value</span>)
   <span class="pl-c1">1384</span>
   <span class="pl-c1">1385</span>     <span class="pl-k">if</span> <span class="pl-s1">flip_order</span>:

<span class="pl-s1">e</span>:\g<span class="pl-s1">ithub</span>\p<span class="pl-s1">andas</span>\p<span class="pl-s1">andas</span>\_<span class="pl-s1">libs</span>\a<span class="pl-s1">lgos_take_helper</span>.<span class="pl-s1">pxi</span> <span class="pl-c1">in</span> <span class="pl-s1">pandas</span>.<span class="pl-s1">_libs</span>.<span class="pl-s1">algos</span>.<span class="pl-en">take_1d_int8_int8</span> (<span class="pl-s1">pandas</span>\_<span class="pl-s1">libs</span>\a<span class="pl-s1">lgos</span>.<span class="pl-s1">c</span>:<span class="pl-c1">75951</span>)()
    <span class="pl-c1">560</span> @<span class="pl-s1">cython</span>.<span class="pl-en">boundscheck</span>(<span class="pl-c1">False</span>)
    <span class="pl-c1">561</span> <span class="pl-k">def</span> <span class="pl-s1">take_1d_int8_int8</span>(<span class="pl-s1">ndarray</span>[<span class="pl-s1">int8_t</span>, <span class="pl-s1">ndim</span><span class="pl-c1">=</span><span class="pl-c1">1</span>] <span class="pl-s1">values</span>,
<span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">562</span>                               <span class="pl-s1">int64_t</span>[:] <span class="pl-s1">indexer</span>,
    <span class="pl-c1">563</span>                               <span class="pl-s1">int8_t</span>[:] <span class="pl-s1">out</span>,
    <span class="pl-c1">564</span>                               <span class="pl-s1">fill_value</span><span class="pl-c1">=</span><span class="pl-s1">np</span>.<span class="pl-s1">nan</span>):

<span class="pl-v">ValueError</span>: <span class="pl-v">Buffer</span> <span class="pl-s1">has</span> <span class="pl-s1">wrong</span> <span class="pl-s1">number</span> <span class="pl-s1">of</span> <span class="pl-en">dimensions</span> (<span class="pl-s1">expected</span> <span class="pl-c1">1</span>, <span class="pl-s1">got</span> <span class="pl-c1">2</span>)</pre></div>
<h4 dir="auto">Problem description</h4>
<p dir="auto"><code class="notranslate">pd.qcut</code> doesn't seem to support <code class="notranslate">ndarray</code> type. However, <a href="https://pandas.pydata.org/pandas-docs/stable/generated/pandas.qcut.html" rel="nofollow">docstrings</a> points <code class="notranslate">x : ndarray or Series</code>.</p>
<p dir="auto">Is this expected behavior or does it imply ndarray means for shape <code class="notranslate">(n, )</code> only?</p>
<p dir="auto">I can confirm this was working in earlier versions.</p>
<h4 dir="auto">Output of <code class="notranslate">pd.show_versions()</code></h4>
<details>
INSTALLED VERSIONS
------------------
commit: None
python: 2.7.12.final.0
python-bits: 64
OS: Windows
OS-release: 7
machine: AMD64
processor: Intel64 Family 6 Model 61 Stepping 4, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None
LOCALE: None.None
<p dir="auto">pandas: 0.22.0.dev0+16.gd70526b<br>
pytest: 3.2.0<br>
pip: 9.0.1<br>
setuptools: 36.2.7<br>
Cython: 0.24.1<br>
numpy: 1.12.1<br>
scipy: 0.19.1<br>
pyarrow: None<br>
xarray: None<br>
IPython: 5.1.0<br>
sphinx: 1.4.6<br>
patsy: 0.4.1<br>
dateutil: 2.5.3<br>
pytz: 2017.2<br>
blosc: None<br>
bottleneck: 1.2.0<br>
tables: 3.2.2<br>
numexpr: 2.6.2<br>
feather: None<br>
matplotlib: 2.0.2<br>
openpyxl: 2.3.2<br>
xlrd: 1.0.0<br>
xlwt: 1.1.2<br>
xlsxwriter: 0.9.3<br>
lxml: 3.6.4<br>
bs4: 4.5.1<br>
html5lib: 0.999999999<br>
sqlalchemy: 1.0.13<br>
pymysql: 0.7.9.None<br>
psycopg2: 2.7.3.1 (dt dec pq3 ext lo64)<br>
jinja2: 2.8<br>
s3fs: None<br>
fastparquet: None<br>
pandas_gbq: None<br>
pandas_datareader: None</p>
</details>