how to save query data into dataframe pscopg2

import pandas as pd
import as sqlio
import psycopg2

conn = psycopg2.connect("host='{}' port={} dbname='{}' user={} password={}".format(host, port, dbname, username, pwd))
sql = "select count(*) from table;"
dat = sqlio.read_sql_query(sql, conn)
conn = None

Here is what the above code is Doing:
1. Connecting to the database using psycopg2
2. Creating a SQL query to select the count of rows in a table
3. Executing the query and storing the results in a pandas dataframe
4. Closing the connection to the database