title: Error handling numpy.float?
body: <p>I am working on a csv file using python.</p>
  
  <p>I wrote the following script to treat the file:</p>
  
  <pre><code>import pickle
  import numpy as np
  from csv import reader, writer
  
  
  dic1 = {'a': 2, 'b': 2, 'c': 2}
  dic2 = {'a': 2,'b': 2,'c': 0}
  number = dict()
  
  for k in dic1:
      number[k] = dic1[k] + dic2[k]
  
  ctVar = {'a': [0.093323751331788565, -1.0872670058072453, '', 8.3574590513050264], 'b': [0.053169909627947334, -1.0825742255395172, '', 8.0033788558001984], 'c': [-0.44681777279768059, 2.2380488442495348]}
  
  Var = {}
  
  for k in number:
      Var[k] = number[k]
  
  
  def findIndex(myList, number):
      n = str(number)
      m = len(n)
      for elt in myList:
          e = str(elt)
          l = len(e)
          mi = min(m,l)
          if e[:mi-1] == n[:mi-1]:
              return myList.index(elt)
  
  def sortContent(myList):
      if '' in myList:
          result = ['']
          myList.remove('')
      else:
          result = []
  
      myList.sort()
      result = myList + result
      return result
  </code></pre>
  
  <p>An extract of the csv file follows: (INFO: The blanks are important. To increase the readability, I noted them BL but they should just be empty cases)</p>
  
  <p>The columns contain few elements (including '') repeated many times.</p>
  
  <blockquote>
    <p>a</p>
    
    <p>0.0933237513</p>
    
    <p>-1.0872670058</p>
    
    <p>0.0933237513</p>
    
    <p>BL</p>
    
    <p>BL</p>
    
    <p>0.0933237513</p>
    
    <p>0.0933237513</p>
    
    <p>0.0933237513</p>
    
    <p>BL</p>
  </blockquote>
  
  <p>Second column:</p>
  
  <blockquote>
    <p>b</p>
    
    <p>0.0531699096</p>
    
    <p>-1.0825742255</p>
    
    <p>0.0531699096</p>
    
    <p>BL</p>
    
    <p>BL</p>
    
    <p>0.0531699096</p>
    
    <p>0.0531699096</p>
    
    <p>0.0531699096</p>
    
    <p>BL</p>
  </blockquote>
  
  <p>Third column:</p>
  
  <blockquote>
    <p>c</p>
    
    <p>-0.4468177728</p>
    
    <p>2.2380488443</p>
    
    <p>-0.4468177728</p>
    
    <p>-0.4468177728</p>
    
    <p>-0.4468177728</p>
    
    <p>-0.4468177728</p>
    
    <p>-0.4468177728</p>
    
    <p>2.2380488443</p>
    
    <p>2.2380488443</p>
  </blockquote>
  
  <p>I just posted an extract of the code (where I am facing a problem) and we can't see its utility. Basically, it is part of a larger code that I use to modify this csv file and encode it differently.</p>
  
  <p>In this extract, I am trying at some point (line 68) to sort elements of a list that contains numbers and ''.</p>
  
  <p>When I remove the line that does this, the elements printed are those of each column (without any repetition).</p>
  
  <p>The problem is that, when I try to sort them, the '' are no longer taken into account. Yet, when I tested my function sortContent with lists that have '', it worked perfectly.</p>
  
  <p>I thought this problem was related to the use of numpy.float64 elements in my list. So I  <a href="https://stackoverflow.com/questions/9452775/converting-numpy-dtypes-to-native-python-types">converted</a> all these elements into floats, but the problem remains.</p>
  
  <p>Any help would be greatly appreciated!</p>