title: Using Python's xlrd module to find column with most dates
body: <p>New to Python (and StackOverflow!), any help would be greatly appreciated. </p>
  
  <p>I'm trying to loop through columns in an excel spreadsheet, and identify which column contains the highest number of date entries.</p>
  
  <p>The problem seems to be with formatting inside the Excel spreadsheet. The dates in my excel file are listed as yyyy-mm-dd, but the module seems to be interpreting them as integers, e.g. 2012-10-12 = 1990. Similarly, a date 3/1/2014 is being interpreted as 3 divided by 1 divided by 2014 = 0.00149.</p>
  
  <p>Up until now I've been using the xlrd module in Python to count the number of dates in a specific column. I've tried with .xls and .xlsx, and have also tried formatting_info=True with no success. </p>
  
  <p>Here is the code of a function I've tried to use...</p>
  
  <pre><code>import xlrd
  from xlrd import open_workbook
  from xlrd import XL_CELL_DATE
  
  def find_maturity_date_column2(file, threshold):
  
      wb = open_workbook(file)
  
      sheet_index = 0
  
      max_sheet_score = 0
      max_col_score = 0
  
      maturity_sheet_index = 0
      maturity_col_index = 0
  
      for a in wb.sheets():
          current_sheet = wb.sheet_by_index(sheet_index)
          sheet_score = 0
          for column in range(0,a.ncols):
              col_score = 0
              for row in range(0,a.nrows):
                  if current_sheet.cell(row,column).ctype == xlrd.XL_CELL_DATE:
                      sheet_score = sheet_score + 1
                      col_score = col_score + 1
                  else:
                      sheet_score = sheet_score
                      col_score = col_score
  
              if sheet_score &gt;= max_sheet_score and col_score &gt; max_col_score:
                  max_col_score = col_score
                  max_sheet_score = sheet_score
                  maturity_sheet_index = sheet_index
                  maturity_col_index = column
              else:
                  max_col_score = max_col_score
                  max_sheet_score = max_sheet_score
                  maturity_sheet_index = maturity_sheet_index
                  maturity_col_index = maturity_col_index            
          sheet_index = sheet_index + 1
  
      if max_col_score &lt; threshold:
          maturity_sheet_index = "None Found"
          maturity_col_index = "None Found"
      else:
          maturity_sheet_index = maturity_sheet_index
          maturity_col_index = maturity_col_index
  
      return maturity_sheet_index, maturity_col_index
  </code></pre>
  
  <p>This code isn't generating any success. Any ideas on how I could fix this? Maybe there is a different way apart from xlrd?</p>
  
  <p>Thanks!</p>
  
  <p>UPDATE: Here is an example of the file input...(in csv format)</p>
  
  <pre><code>Tranche,Maturity Date,Country,Currency,Initial Spread
  Term Loan B,2020-10-12,USA,USD,0.025
  Term Loan B,2020-11-02,USA,USD,0.0275
  Term Loan B,2020-05-22,USA,USD,0.0275
  </code></pre>
  
  <p>How do I build a process that will identify that column = 1 is the column with the highest number of dates (when the module interprets column 1 values to be integers instead of dates)</p>