I have connected my Python via a Jupyter Notebook to my local Postgresql database. I am able to run a SELECT query successfully and extract out the data from my table.
However, I want to show the rows of data in my Postgresql table as a dataframe instead of what I currently have.
Below is my code:
conn = psycopg2.connect("dbname=juke user=postgres")
cur = conn.cursor()
cur.execute('SELECT * FROM albums')
for i in cur:
print(i)
This is my output from the code:
How do I get the output to show as rows in a dataframe instead?
I looked at and tried a bunch of different possible solutions from recommended duplicate post that people shared. Unfortunately, none of them worked.