How can I add the columns names from sql query to pandas dataframe. I'm doing the following, but columns=columns
doesn't work in my case.
import pymssql
import pandas as pd
con = pymssql.connect(
server="MSSQLSERVER",
port="1433",
user="us",
password="pass",
database="loc")
cur = conn.cursor()
cur.execute("SELECT id from ide")
data=cur.fetchall()
pandas=pd.DataFrame(data)
cur.close()
con.close()
So when I print "pandas" it turns out to be without headers. So how can I receive them?