title: How to read sql query to pandas dataframe / python / django
body: <p>I'm using this below in <strong>views.py</strong> to get app</p>
  
  <pre><code>from django.db import connection
  
  def test(request):
  
      cursor = connection.cursor()
      sql = """
      SELECT x , n
      from table1 limit 10
      """
      cursor.execute(sql)
      rows = cursor.fetchall()
  
      # df1 = pd.read_sql_query(sql,cursor)  &lt;==&gt; not working ) 
      # df1.columns = cursor.keys()    &lt;==&gt; not working ) 
  
      return render(request, 'app/test.html',{ "row" : rows,})
  </code></pre>
  
  <p>I am able to print row and got a list of something like this below in <strong>test.html</strong></p>
  
  <pre><code>row((x1,yvalue1),(x2,yvalue2) , .... ))
  </code></pre>
  
  <p>But what I'm trying to do is to get all data with its column name that I fetched and put into dataframe , hopefully to use something like this below : </p>
  
  <p><a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.read_sql_query.html#pandas.read_sql_query" rel="noreferrer">http://pandas.pydata.org/pandas-docs/stable/generated/pandas.read_sql_query.html#pandas.read_sql_query</a> </p>