title: Seaborn showing values not found in Pandas columns
body: <p>Original dataframe:</p>
  
  <pre><code>dp.head(10)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/912kR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/912kR.png" alt="enter image description here"></a></p>
  
  <p>Creating new dataframe using recommended selection method:</p>
  
  <pre><code>dtest = pd.DataFrame(dp[dp['numdept'].isin([3,6,8,10])]).dropna()
  dtest.reset_index(drop =True, inplace = True)
  dtest.head(10)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/peADA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/peADA.png" alt="enter image description here"></a></p>
  
  <p>Testing to make sure that only the values in [3,6,8,10] are in dtest['numdept']:</p>
  
  <pre><code>print "numdept is 5:", dtest[dtest["numdept"].isin ([5])]
  print "set of distinct values in the numdept column:", sorted(set(dtest['numdept'].tolist()))
  
  &gt;&gt; numdept is 5: Empty DataFrame
  &gt;&gt; Columns: [numgrade, numyear, numdept]
  &gt;&gt; Index: []
  &gt;&gt; set of distinct values in the numdept column: [3, 6, 8, 10]
  </code></pre>
  
  <p>Plotting:</p>
  
  <pre><code>plt.figure(figsize=(16, 8))
  sb.boxplot(x="numyear", y="numgrade", hue="numdept", data=dtest)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/RYLiC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RYLiC.png" alt="enter image description here"></a></p>
  
  <p><strong>Question</strong>:  Why are the "nummdept" categories in the plot legend showing values other than 3,6,8,10? </p>
  
  <p>Problem surfaced in an ipython notebook, but recurs even when I carry the code to a regular environment.  Also tried to avoid seaborn related issues by using the suggestion <a href="https://stackoverflow.com/questions/25393936/how-can-i-use-seaborn-without-changing-the-matplotlib-defaults">here</a>, to no avail.</p>
  
  <p>Using Canopy 1.7.4.3348, jupyter 1.0.0-15, pandas 0.19.0-1 matplotlib 1.5.1-9 and seaborn 0.7.0-6</p>
  
  <p><strong>EDIT:</strong> On an impulse, inserted the following before the plotting code:</p>
  
  <pre><code>grouped = dtest.groupby(['numdept', 'numyear'])
  grouped.mean()
  </code></pre>
  
  <p>The output has <code>numdept</code> values that should not exist in <code>dtest</code>.</p>
  
  <p><a href="https://i.stack.imgur.com/IadDN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IadDN.png" alt="enter image description here"></a></p>
  
  <p>Does this make it a pandas bug?</p>