<h4 dir="auto">Code Sample, a copy-pastable example if possible</h4>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="In [2]: keys = ['c', 'a', 'b', 'c']

In [3]: tm = pd.DataFrame(index=pd.MultiIndex.from_tuples([('b', 1), ('b', 2), ('a', 1), ('c', 1)]),
   ...:                   columns=range(3))

In [4]: tm.loc[keys] # bad
Out[4]: 
       0    1    2
b 1  NaN  NaN  NaN
  2  NaN  NaN  NaN
a 1  NaN  NaN  NaN
c 1  NaN  NaN  NaN

In [5]: tm.transpose().loc[:, keys].transpose() # bad
Out[5]: 
       0    1    2
b 1  NaN  NaN  NaN
  2  NaN  NaN  NaN
a 1  NaN  NaN  NaN
c 1  NaN  NaN  NaN

In [6]: tm.loc[[(k, 1) for k in keys]] # complete indexing: good
Out[6]: 
       0    1    2
c 1  NaN  NaN  NaN
a 1  NaN  NaN  NaN
b 1  NaN  NaN  NaN
c 1  NaN  NaN  NaN

In [7]: tf = pd.DataFrame(index=['b', 'a', 'c'],
   ...:                  columns=range(3))

In [8]: tf.loc[keys] # flat index: good
Out[8]: 
     0    1    2
c  NaN  NaN  NaN
a  NaN  NaN  NaN
b  NaN  NaN  NaN
c  NaN  NaN  NaN"><pre class="notranslate"><span class="pl-v">In</span> [<span class="pl-c1">2</span>]: <span class="pl-s1">keys</span> <span class="pl-c1">=</span> [<span class="pl-s">'c'</span>, <span class="pl-s">'a'</span>, <span class="pl-s">'b'</span>, <span class="pl-s">'c'</span>]

<span class="pl-v">In</span> [<span class="pl-c1">3</span>]: <span class="pl-s1">tm</span> <span class="pl-c1">=</span> <span class="pl-s1">pd</span>.<span class="pl-v">DataFrame</span>(<span class="pl-s1">index</span><span class="pl-c1">=</span><span class="pl-s1">pd</span>.<span class="pl-v">MultiIndex</span>.<span class="pl-en">from_tuples</span>([(<span class="pl-s">'b'</span>, <span class="pl-c1">1</span>), (<span class="pl-s">'b'</span>, <span class="pl-c1">2</span>), (<span class="pl-s">'a'</span>, <span class="pl-c1">1</span>), (<span class="pl-s">'c'</span>, <span class="pl-c1">1</span>)]),
   ...:                   <span class="pl-s1">columns</span><span class="pl-c1">=</span><span class="pl-en">range</span>(<span class="pl-c1">3</span>))

<span class="pl-v">In</span> [<span class="pl-c1">4</span>]: <span class="pl-s1">tm</span>.<span class="pl-s1">loc</span>[<span class="pl-s1">keys</span>] <span class="pl-c"># bad</span>
<span class="pl-v">Out</span>[<span class="pl-c1">4</span>]: 
       <span class="pl-c1">0</span>    <span class="pl-c1">1</span>    <span class="pl-c1">2</span>
<span class="pl-s1">b</span> <span class="pl-c1">1</span>  <span class="pl-v">NaN</span>  <span class="pl-v">NaN</span>  <span class="pl-v">NaN</span>
  <span class="pl-c1">2</span>  <span class="pl-v">NaN</span>  <span class="pl-v">NaN</span>  <span class="pl-v">NaN</span>
<span class="pl-s1">a</span> <span class="pl-c1">1</span>  <span class="pl-v">NaN</span>  <span class="pl-v">NaN</span>  <span class="pl-v">NaN</span>
<span class="pl-s1">c</span> <span class="pl-c1">1</span>  <span class="pl-v">NaN</span>  <span class="pl-v">NaN</span>  <span class="pl-v">NaN</span>

<span class="pl-v">In</span> [<span class="pl-c1">5</span>]: <span class="pl-s1">tm</span>.<span class="pl-en">transpose</span>().<span class="pl-s1">loc</span>[:, <span class="pl-s1">keys</span>].<span class="pl-en">transpose</span>() <span class="pl-c"># bad</span>
<span class="pl-v">Out</span>[<span class="pl-c1">5</span>]: 
       <span class="pl-c1">0</span>    <span class="pl-c1">1</span>    <span class="pl-c1">2</span>
<span class="pl-s1">b</span> <span class="pl-c1">1</span>  <span class="pl-v">NaN</span>  <span class="pl-v">NaN</span>  <span class="pl-v">NaN</span>
  <span class="pl-c1">2</span>  <span class="pl-v">NaN</span>  <span class="pl-v">NaN</span>  <span class="pl-v">NaN</span>
<span class="pl-s1">a</span> <span class="pl-c1">1</span>  <span class="pl-v">NaN</span>  <span class="pl-v">NaN</span>  <span class="pl-v">NaN</span>
<span class="pl-s1">c</span> <span class="pl-c1">1</span>  <span class="pl-v">NaN</span>  <span class="pl-v">NaN</span>  <span class="pl-v">NaN</span>

<span class="pl-v">In</span> [<span class="pl-c1">6</span>]: <span class="pl-s1">tm</span>.<span class="pl-s1">loc</span>[[(<span class="pl-s1">k</span>, <span class="pl-c1">1</span>) <span class="pl-k">for</span> <span class="pl-s1">k</span> <span class="pl-c1">in</span> <span class="pl-s1">keys</span>]] <span class="pl-c"># complete indexing: good</span>
<span class="pl-v">Out</span>[<span class="pl-c1">6</span>]: 
       <span class="pl-c1">0</span>    <span class="pl-c1">1</span>    <span class="pl-c1">2</span>
<span class="pl-s1">c</span> <span class="pl-c1">1</span>  <span class="pl-v">NaN</span>  <span class="pl-v">NaN</span>  <span class="pl-v">NaN</span>
<span class="pl-s1">a</span> <span class="pl-c1">1</span>  <span class="pl-v">NaN</span>  <span class="pl-v">NaN</span>  <span class="pl-v">NaN</span>
<span class="pl-s1">b</span> <span class="pl-c1">1</span>  <span class="pl-v">NaN</span>  <span class="pl-v">NaN</span>  <span class="pl-v">NaN</span>
<span class="pl-s1">c</span> <span class="pl-c1">1</span>  <span class="pl-v">NaN</span>  <span class="pl-v">NaN</span>  <span class="pl-v">NaN</span>

<span class="pl-v">In</span> [<span class="pl-c1">7</span>]: <span class="pl-s1">tf</span> <span class="pl-c1">=</span> <span class="pl-s1">pd</span>.<span class="pl-v">DataFrame</span>(<span class="pl-s1">index</span><span class="pl-c1">=</span>[<span class="pl-s">'b'</span>, <span class="pl-s">'a'</span>, <span class="pl-s">'c'</span>],
   ...:                  <span class="pl-s1">columns</span><span class="pl-c1">=</span><span class="pl-en">range</span>(<span class="pl-c1">3</span>))

<span class="pl-v">In</span> [<span class="pl-c1">8</span>]: <span class="pl-s1">tf</span>.<span class="pl-s1">loc</span>[<span class="pl-s1">keys</span>] <span class="pl-c"># flat index: good</span>
<span class="pl-v">Out</span>[<span class="pl-c1">8</span>]: 
     <span class="pl-c1">0</span>    <span class="pl-c1">1</span>    <span class="pl-c1">2</span>
<span class="pl-s1">c</span>  <span class="pl-v">NaN</span>  <span class="pl-v">NaN</span>  <span class="pl-v">NaN</span>
<span class="pl-s1">a</span>  <span class="pl-v">NaN</span>  <span class="pl-v">NaN</span>  <span class="pl-v">NaN</span>
<span class="pl-s1">b</span>  <span class="pl-v">NaN</span>  <span class="pl-v">NaN</span>  <span class="pl-v">NaN</span>
<span class="pl-s1">c</span>  <span class="pl-v">NaN</span>  <span class="pl-v">NaN</span>  <span class="pl-v">NaN</span></pre></div>
<h4 dir="auto">Problem description</h4>
<p dir="auto">Partial indexing of a <code class="notranslate">MultiIndex</code> with a list discards order/repetitions.</p>
<h4 dir="auto">Expected Output</h4>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="In [9]: pd.concat([tm.loc[[k]] for k in keys])
Out[9]: 
       0    1    2
c 1  NaN  NaN  NaN
a 1  NaN  NaN  NaN
b 1  NaN  NaN  NaN
  2  NaN  NaN  NaN
c 1  NaN  NaN  NaN"><pre class="notranslate"><span class="pl-v">In</span> [<span class="pl-c1">9</span>]: <span class="pl-s1">pd</span>.<span class="pl-en">concat</span>([<span class="pl-s1">tm</span>.<span class="pl-s1">loc</span>[[<span class="pl-s1">k</span>]] <span class="pl-k">for</span> <span class="pl-s1">k</span> <span class="pl-c1">in</span> <span class="pl-s1">keys</span>])
<span class="pl-v">Out</span>[<span class="pl-c1">9</span>]: 
       <span class="pl-c1">0</span>    <span class="pl-c1">1</span>    <span class="pl-c1">2</span>
<span class="pl-s1">c</span> <span class="pl-c1">1</span>  <span class="pl-v">NaN</span>  <span class="pl-v">NaN</span>  <span class="pl-v">NaN</span>
<span class="pl-s1">a</span> <span class="pl-c1">1</span>  <span class="pl-v">NaN</span>  <span class="pl-v">NaN</span>  <span class="pl-v">NaN</span>
<span class="pl-s1">b</span> <span class="pl-c1">1</span>  <span class="pl-v">NaN</span>  <span class="pl-v">NaN</span>  <span class="pl-v">NaN</span>
  <span class="pl-c1">2</span>  <span class="pl-v">NaN</span>  <span class="pl-v">NaN</span>  <span class="pl-v">NaN</span>
<span class="pl-s1">c</span> <span class="pl-c1">1</span>  <span class="pl-v">NaN</span>  <span class="pl-v">NaN</span>  <span class="pl-v">NaN</span></pre></div>
<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.5.3.final.0<br>
python-bits: 64<br>
OS: Linux<br>
OS-release: 4.9.0-3-amd64<br>
machine: x86_64<br>
processor:<br>
byteorder: little<br>
LC_ALL: None<br>
LANG: it_IT.UTF-8<br>
LOCALE: it_IT.UTF-8</p>
<p dir="auto">pandas: 0.22.0.dev0+135.g9c799e2c4<br>
pytest: 3.2.3<br>
pip: 9.0.1<br>
setuptools: 36.7.0<br>
Cython: 0.25.2<br>
numpy: 1.12.1<br>
scipy: 0.19.0<br>
pyarrow: None<br>
xarray: None<br>
IPython: 6.2.1<br>
sphinx: 1.5.6<br>
patsy: 0.4.1<br>
dateutil: 2.6.1<br>
pytz: 2017.2<br>
blosc: None<br>
bottleneck: 1.2.0dev<br>
tables: 3.3.0<br>
numexpr: 2.6.1<br>
feather: 0.3.1<br>
matplotlib: 2.0.0<br>
openpyxl: None<br>
xlrd: 1.0.0<br>
xlwt: 1.1.2<br>
xlsxwriter: 0.9.6<br>
lxml: None<br>
bs4: 4.5.3<br>
html5lib: 0.999999999<br>
sqlalchemy: 1.0.15<br>
pymysql: None<br>
psycopg2: None<br>
jinja2: 2.10<br>
s3fs: None<br>
fastparquet: None<br>
pandas_gbq: None<br>
pandas_datareader: 0.2.1</p>
</details>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="In [40]: cols = pd.MultiIndex.from_product([['A', 'B', 'C'],[1,2]])

In [41]: df = pd.DataFrame(np.random.randn(5,6), columns=cols)

In [42]: df.loc[:, ['B', 'A']]
Out[42]:
          A                   B
          1         2         1         2
0 -0.990868  1.577803  1.023247 -0.423165
1 -1.180170  1.236143 -1.484085  0.044929
2  1.665502 -0.711081  0.227827  0.651859
3 -0.659154  0.154327 -1.548650 -0.070550
4 -0.232819  0.100959 -0.102296  0.260816"><pre class="notranslate"><code class="notranslate">In [40]: cols = pd.MultiIndex.from_product([['A', 'B', 'C'],[1,2]])

In [41]: df = pd.DataFrame(np.random.randn(5,6), columns=cols)

In [42]: df.loc[:, ['B', 'A']]
Out[42]:
          A                   B
          1         2         1         2
0 -0.990868  1.577803  1.023247 -0.423165
1 -1.180170  1.236143 -1.484085  0.044929
2  1.665502 -0.711081  0.227827  0.651859
3 -0.659154  0.154327 -1.548650 -0.070550
4 -0.232819  0.100959 -0.102296  0.260816
</code></pre></div>