title: key error and MultiIndex lexsort depth
body: <p>I have a set of tab delimited files that I have to go through read them, use them as pandas dataframe, do a whole bunch of operations on them and then merge them back to one excel file, the code is too long so I am going to go through the problematic part of it</p>
  
  <p>The tab files that I am parsing contains all the same number of rows 2177</p>
  
  <p>When I read these files I am indexing by the first 2 columns of type (string, int)</p>
  
  <pre><code>df = df.set_index(['id', 'coord'])
  data = OrderedDict()
  #data will contain all the information I am writing to excel
  data[filename_id] = df
  </code></pre>
  
  <p>one of the procedures I am doing needs access to each row of data[sample_id] which contains dataframe of mixed types indexed with the columns 'id' and 'coord', like this </p>
  
  <pre><code>sample_row = data[sample].ix[index]
  </code></pre>
  
  <p>my index being ('id','coord')</p>
  
  <p>If I am treating a subset of the file everything works great, but If I read the entire files with 2177 lines I end up having this error message </p>
  
  <pre><code>KeyError: 'Key length (2) was greater than MultiIndex lexsort depth (0)'
  </code></pre>
  
  <p>I searched over SO and everywhere and it seems that this is an issue of sorting the index, but I dont understand why using an unsorted subset do not cause the problem</p>
  
  <p>Any idea on how I can get this sorted out ?</p>
  
  <p>Thanks</p>