title: Why is my code not posting the requested columns in main def?
body: <p>I don't expect any coding answers, more just guidance. For my project I have to date-mine apple stock prices from a csv-file and implement it in my code. I provided a sample output below.</p>
  <p><a href="https://imgur.com/rPOPN1I" rel="nofollow noreferrer">https://imgur.com/rPOPN1I</a></p>
  <p>Right now, I am not getting any error messages but my code is not posting the columns requested from the csv.file. Are my definitions at fault or am I missing something else?</p>
  <pre><code># Project No.: 5
  # Author: burntchickennuget
  # Description: making definitions, reading from a .csv file, validating input, data-mining,
  
  f_list = list()
  file_object = ()
  my_tot = dict()
  new_list = list()
  
  def get_input_descriptor():
      while True:
          filename = input(&quot;Enter a file name: &quot;)
          if filename == 'table.csv':
              with open(filename, &quot;r&quot;) as infile:
                  infile.readlines()[1:]
                  # for line in lines:
                  #     print(line.rstrip())
                  break
          else:
              print(&quot;Bad file name, try again&quot;)
      return filename
  
  def get_data_list(file_object, column_number):
      dict = {}
      for val in file_object:
          date = val.split(&quot;,&quot;)[0]
          data = float(val.split(&quot;,&quot;)[column_number])
          dict[date] = data
      return dict.items()
  
  def average_data(new_list):
      for date, price in new_list:
          my_tot[date] = my_tot.get(date, 0) + float(price)
          my_times[date] = my_times.get(date, 0) + 1
      for key in my_tot:
          f_list.append((float(my_tot[key] / my_times[key]), key))
  
  
  def main():
      get_input_descriptor()
      column_number = int(input(&quot;Which column: &quot;))
      date_list = get_data_list(file_object, column_number)
      final_list = average_data(date_list)
      x = sorted(f_list)
      print('Lowest 6:')
      for tup in x[:6]:
          print
          tup[0], tup[1]
      print('Highest 6:')
      x = sorted(f_list, reverse=True)
      for tup in x[:6]:
          print
          tup[0], tup[1]
  
      while 1:
          flag = input(&quot;do you want to continue? &quot;)
          if flag == '' or not flag[0].lower() in ['y', 'n']:
              print(&quot;Please answer with a yes or no&quot;)
          else:
              break
      if flag[0].lower() == 'y':
          column = input(&quot;Which column: &quot;)
          print(column)
  
      if flag[0].lower() == 'n':
          print(&quot;Bye!&quot;)
  
  
  
  if __name__ == &quot;__main__&quot;:
      main()
  </code></pre>
  <p>What can I try next?</p>