title: Take Flask Form Data Input and Turn it Into Pandas Dataframe For ML Modeling
body: <p>I'm building a small flask application to take in form data from an HTML. I'd like to convert this form data (each selection get put into a column) into a Pandas DataFrame. I will then use a pickle file to create a prediction off this DataFrame. Problem i'm having now is not knowing how to convert the data I have inputted into a Pandas DataFrame.</p>
  
  <p>I believe I have my request information in my variable result but i'm not sure how to proceed from here.</p>
  
  <h1>App.py File</h1>
  
  <pre><code>from flask import Flask, render_template, request
  app = Flask(__name__)
  
  @app.route('/')
  def student():
      colours = ['RED', 'BLUE', 'BLACK', 'ORANGE']
      return render_template('student.html', colours = colours)
  
  @app.route('/result',methods = ['POST', 'GET'])
      def result():
      if request.method == 'POST':
          result = request.form
          return render_template("result.html", result = result)
  
  if __name__ == '__main__':
      app.run(debug=True, port=8080) #run app in debug mode on port 5000
  </code></pre>
  
  <h1>student.html</h1>
  
  <pre><code>&lt;html&gt;
  &lt;body&gt;
      &lt;form action="http://localhost:8080/result" method="POST"&gt;
          &lt;p&gt;Year of Test &lt;input type="text" name="TestYear" /&gt;&lt;/p&gt;
          &lt;p&gt;Yeah of Student &lt;input type="text" name="StudentYear" /&gt;&lt;/p&gt;
          &lt;p&gt;State of Student &lt;input type="text" name="StudentState" /&gt;&lt;/p&gt;
          &lt;p&gt;Origin State &lt;input type="text" name="OriginState" /&gt;&lt;/p&gt;
          &lt;p&gt;Shirt Color &lt;select name=color method="GET" action="/"&gt;
              {% for colour in colours %}
              &lt;option value="{{colour}}" SELECTED&gt;{{colour}}&lt;/option&gt;"
              {% endfor %}
          &lt;/select&gt;&lt;/p&gt;
          &lt;p&gt;&lt;input type="submit" value="submit" /&gt;&lt;/p&gt;
      &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>