I have the following code of a PostgreSQL table, I need you to print the name of columns as a header, with Tabulate and Python, I only get the numbering of the columns as a header, I do not know why:
cur.execute("""select * from admin_eps""")
rows = [cur.fetchall()]
for row in rows:
print(tabulate(row, headers="keys", tablefmt='fancy_grid', stralign='left'))
This is the exit report:
│ 0 │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │
╞═════╪═══════════╪═════════════╪══════════════════╪══════════╪════════╪════════╪═════════════════════╪══════════════════╡
│ 2 │ 890890890 │ Medimas │ carr 26 n 10-20 │ Bogota │ 520520 │ 311311 │ [email protected] │ wwww.medimas.com │
├─────┼───────────┼─────────────┼──────────────────┼──────────┼────────┼────────┼─────────────────────┼──────────────────┤
│ 1 │ 54321 │ COOMEVA EPS │ Calle 30 n 33-30 │ Medellin │ 252444 │ 320320 │ [email protected] │ www.coom.com │
╘═════╧═══════════╧═════════════╧══════════════════╧══════════╧════════╧════════╧═════════════════════╧══════════════════╛