Last active
January 23, 2024 11:03
-
-
Save csiebler/5895581704bb27b88f779c1fc03cab4c to your computer and use it in GitHub Desktop.
Mount Dataset to Azure Machine Learning Compute Instance
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import pandas as pd | |
from azureml.core import Workspace, Dataset | |
# Connect to Workspace and reference Dataset | |
ws = Workspace.from_config() | |
dataset = ws.datasets["german-credit-train-tutorial"] | |
# Create mountcontext and mount the dataset | |
mount_ctx = dataset.mount() | |
mount_ctx.start() | |
# Get the mount point | |
dataset_mount_folder = mount_ctx.mount_point | |
print(dataset_mount_folder) | |
# List the files in the mount point | |
files = os.listdir(dataset_mount_folder) | |
print(files) | |
# Read some data | |
df = pd.read_csv(os.path.join(dataset_mount_folder, 'german_credit_data.csv')) | |
# Do some more stuff with the data.... | |
# Unmount the dataset from the instance | |
mount_ctx.stop() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment