title: How to display CSV data as a table view on html page using flask?
body: <p>I'm using Python 3.7.7 and working on the following:</p>
  <p>I have a directory with csv files that are being created in this folder daily:</p>
  <pre><code>daily-2020-08-19.csv
  daily-2020-08-18.csv
  daily-2020-08-17.csv
  ... and so on...
  </code></pre>
  <p>structure of my data file is sorted by customers:</p>
  <pre><code>daily-2020-08-17.csv
  userId, calls, customers, emails
    2       0       11        30
    1       1       5         11
    3       11      0         0
      daily-2020-08-18.csv
  userId, calls, customers, emails
    1       11      15       5
    2       0       2        5
    3       1       1        1
    5       0       1        1
    4       0       0        0
  daily-2020-08-19.csv
  userId, calls, customers, emails
    2       13      30       55
    1       11      15       5
    5       3       3        5
    3       2       2        1
    4       1       1        3
    7       1       1        1
    6       10      0        5
  </code></pre>
  <p>userId = numbers of active users on a given day. With time there is expected a higher number of Ids as new users are registering everyday.</p>
  <p>I've managed to sum data for the last 3 days using pandas and now I have 3days.csv:</p>
  <pre><code>userId, customers
    2        43
    1        35
    5        4
    3        3
    4        1
    7        1
    6        0
  </code></pre>
  <p>How can I display the above data as a table view on html page using flask? I'm completely new to flask and aiming to have userId showing in my table as an URL which would then bring me to a separate html page specific to that particular userID.</p>
  <p>My code so far:</p>
  <pre><code>from flask import Flask
  import os
  
  app = Flask (__name__)
  
  #fun var
  
  filepath = os.path.join(os.path.dirname(__file__),'path/to/my/3days.csv')
  
  open_read = open(filepath,'r')
  page =''
  
  while True:
      read_data = open_read.readline()
      page += '&lt;p&gt;%s&lt;/p&gt;' % read_data
      if open_read.readline() == '':
          break
  
  @app.route(&quot;/&quot;)
  def index():
      return page
  
  
  if __name__ == &quot;__main__&quot;:
      app.run()
  </code></pre>
  <p>With the above code I managed to get only some values from my 3days.csv. However I need a table view with userId as URL that brings to web page dedicated to the particular userId. Could someone help with this?</p>
  <p>Output:</p>
  <p><a href="https://i.stack.imgur.com/qMHxi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qMHxi.png" alt="enter image description here" /></a></p>
  <p>Thank you in advance!</p>