title: Very strange Pandas behavior while using multi-indexing
body: <p>I use the following code to create a Pandas DataFrame with multi-index and update some values.</p>
  
  <pre class="lang-py prettyprint-override"><code>indices = pd.MultiIndex.from_product(iterables=[['X','Y','Z'],['h1','h2','h3']],names=['idx1','idx2'])
  df = pd.DataFrame(0.0,index=indices,columns=['A'])
  
  df.loc['X','A']['h1'] = 1.1
  df.loc['Y','A']['h1'] = 2.2
  df.loc['Z','A']['h1'] = 3.3
  
  print(df)
  </code></pre>
  
  <p>This code generates the following output, as expected:</p>
  
  <pre class="lang-py prettyprint-override"><code>             A
  idx1 idx2
  X    h1    1.1
       h2    0.0
       h3    0.0
  Y    h1    2.2
       h2    0.0
       h3    0.0
  Z    h1    3.3
       h2    0.0
       h3    0.0
  </code></pre>
  
  <p>But when I use the following code (note the 'Y' in the first index is moved at the end), the output is wrong:</p>
  
  <pre><code>import pandas as pd
  indices = pd.MultiIndex.from_product(iterables=[['X','Z','Y'],['h1','h2','h3']],names=['idx1','idx2'])
  df = pd.DataFrame(0.0,index=indices,columns=['A'])
  
  df.loc['X','A']['h1'] = 1.1
  df.loc['Y','A']['h1'] = 2.2
  df.loc['Z','A']['h1'] = 3.3
  
  print(df)
  </code></pre>
  
  <pre class="lang-py prettyprint-override"><code>             A
  idx1 idx2
  X    h1    0.0
       h2    0.0
       h3    0.0
  Z    h1    0.0
       h2    0.0
       h3    0.0
  Y    h1    0.0
       h2    0.0
       h3    0.0
  </code></pre>
  
  <p>What's wrong with my second code? I am doing something really stupid, or is it some sort of expected behavior?</p>
  
  <p>I tried on python 3.7.1 and 3.6.8, with pandas 0.23.4 in both cases.</p>