Skip to content

Accessing mimic IV database on the HITI server

Judy Gichoya edited this page Jan 24, 2021 · 2 revisions

Summary Code

Code

!pip install --user psycopg2

import psycopg2

import pandas as pd

conn = psycopg2.connect("dbname=mimic user=mimic password=Mimic@4@plhi")

cur = conn.cursor()

def create_pandas_table(sql_query, database = conn):
    table = pd.read_sql_query(sql_query, database)
    return table

df = create_pandas_table("select * from mimic_core.patients")

df