我正在尝试使用反洗钱的autoML功能。我在示例笔记本中看到,它使用的是Dataset.Tabular.from_delimited_files(train_data),它只从https路径获取数据。我想知道如何使用pandas dataframe直接自动配置而不是使用dataset API。或者,如何将pandas数据帧转换为表格数据集以传递到自动配置?
发布于 2019-12-04 06:38:45
您可以很容易地将您的熊猫数据帧保存到parquet,将数据上传到工作区的默认blob存储,然后从那里创建一个Dataset:
# ws = <your AzureML workspace>
# df = <contains a pandas dataframe>
from azureml.core.dataset import Dataset
os.makedirs('mydata', exist_ok=True)
df.to_parquet('mydata/myfilename.parquet')
dataref = ws.get_default_datastore().upload('mydata')
dataset = Dataset.Tabular.from_parquet_files(path = dataref.path('myfilename.parquet'))
dataset.to_pandas_dataframe()或者,您也可以仅从门户http://ml.azure.com中的本地文件创建Dataset

一旦您在门户中创建了它,它将为您提供加载它的代码,如下所示:
# azureml-core of version 1.0.72 or higher is required
from azureml.core import Workspace, Dataset
subscription_id = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
resource_group = 'ignite'
workspace_name = 'ignite'
workspace = Workspace(subscription_id, resource_group, workspace_name)
dataset = Dataset.get_by_name(workspace, name='IBM-Employee-Attrition')
dataset.to_pandas_dataframe()https://stackoverflow.com/questions/59144503
复制相似问题