Launch price: every exam for $29.99 a year, for the first 300 buyers. See the price

CertStreak
Menu

Create and manage data assets

A worked example

Complete the statement

A colleague registered version 3 of an MLTable data asset named green-quickstart in your Azure Machine Learning workspace. In a notebook, you have already created an authenticated MLClient named ml_client and imported the mltable package.

You must:

  • retrieve version 3 of the existing data asset without changing it
  • apply the data loading steps saved in the asset
  • get the full result as a Pandas data frame named df for analysis

Complete the Python code.

VERSION = "3"
data_asset = ml_client.data.get(name="green-quickstart", version=VERSION)
tbl = mltable.load(f"azureml:/{data_asset.id}")
df = tbl.()
  • Blank 1: to_pandas_dataframe (correct answer)

    to_pandas_dataframe materializes the table as a Pandas data frame, as required. show displays a preview, as illustrated by tbl.show(5), rather than producing the full data frame. save writes the loading definition to an MLTable file rather than producing a data frame.

Why

After an MLTable is registered as a data asset, team members can use its friendly name in a notebook. They retrieve the asset with ml_client.data.get for a specific name and version. mltable.load with the azureml:/ asset ID then reproduces the saved loading steps. Finally, to_pandas_dataframe() loads the data into a Pandas data frame.

Practise this topic until it's automatic.

Ten questions a day, every answer explained, and misses that come back until you beat them.

Start free