Skip to content

load_medications_idb

Load and return the IDB medications dataset (PHI).

Returns:

Name Type Description
data Bunch

Dictionary-like object, with the following attributes.

  • data : pandas DataFrame The data matrix.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
from msk_cdm.datasets import connect_to_db
from msk_cdm.datasets.impact import load_medications_idb

# Connect to the database
auth_file = 'path/to/config.txt'
connect_to_db(auth_file=auth_file)

# Load the dataset
df_medications = load_medications_idb()

# Access the data
df = df_medications['data']

# Display the first few rows of the data
print(df.head())
Source code in msk_cdm/datasets/phi/idb/datasets_phi_idb.py
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
def load_medications_idb() -> Bunch:
    """Load and return the IDB medications dataset (PHI).

    Returns:
        data: Dictionary-like object, with the following attributes.

            - **data** : pandas DataFrame
                The data matrix.

    Examples
    --------
    ```python
    from msk_cdm.datasets import connect_to_db
    from msk_cdm.datasets.impact import load_medications_idb

    # Connect to the database
    auth_file = 'path/to/config.txt'
    connect_to_db(auth_file=auth_file)

    # Load the dataset
    df_medications = load_medications_idb()

    # Access the data
    df = df_medications['data']

    # Display the first few rows of the data
    print(df.head())
    ```
    """
    df = _loader._load_phi_idb_medications()
    data = Bunch(data=df)
    return data