0

I'm experiencing a problem when a try to import a table from a data base, using pandas and psycopg2. The code that I used is as follows:

import psycopg2 as psy
import pandas as pd
conn = psy.connect(dbname=db, user = user, host = hst, password = psswrd, port = prt)
cur = conn.cursor()
query = 'SELECT * FROM table'
cur.excute(query)
df = pd.DataFrame(cur.fetchall())

My problem is that the result, the table df, comes with a fewer lines than expected (5000 lines instead 7000 lines).

The same problem occurs when I try to import the table with

df = pd.read_sql_query(query,conn)
user34870
  • 105
  • 4

0 Answers0