<p dir="auto">One feature about DataFrame that I found uncomfortable is the inconsistency of results:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="x = pd.DataFrame({'A': [1,2,3,4,5]}, index=['a','b','c','d','e'])
x.loc[['a', 'f']]  # fine, value of 'f' is numpy.nan
x.loc[['f']]  # throws "><pre class="notranslate"><code class="notranslate">x = pd.DataFrame({'A': [1,2,3,4,5]}, index=['a','b','c','d','e'])
x.loc[['a', 'f']]  # fine, value of 'f' is numpy.nan
x.loc[['f']]  # throws 
</code></pre></div>
<p dir="auto">When developing data applications, I spend lot of time fixing this issue.  I think we should make it more consistent. Either always returns (preferred) or always throws.</p>
<p dir="auto">I just upgraded to latest Pandas 0.16, and the new error has hit me (with Pandas 0.15) when slicing with multiple values. (df.ix[[list_of_values]]). I actually think it is more valid to return an empty DataFrame, than to throw an error.</p>
<p dir="auto">The best I've been able to come up with to reproduce the previous behaviour (fail silently, return empty DataFrame) is:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="# I want to filter a DataFrame by the first level of the index
df.ix[df.reset_index().IndexValue.isin(list_of_values).values]"><pre class="notranslate"><span class="pl-c"># I want to filter a DataFrame by the first level of the index</span>
<span class="pl-s1">df</span>.<span class="pl-s1">ix</span>[<span class="pl-s1">df</span>.<span class="pl-en">reset_index</span>().<span class="pl-v">IndexValue</span>.<span class="pl-en">isin</span>(<span class="pl-s1">list_of_values</span>).<span class="pl-s1">values</span>]</pre></div>
<p dir="auto">Not saying I'm right on the error/empty argument; but is the above the most elegant solution?</p>
<p dir="auto">Perhaps we should consider three distinct slicing operations:</p>
<ol dir="auto">
<li>Insists on everything being there (and throws errors)</li>
<li>Creates spaces where there is nothing there (reindex)</li>
<li>Just returns what's present, leaving the rest out (silent error)</li>
</ol>
<p dir="auto">I would think anyone indexing would be vary aware of what they are expecting from the above?</p>