create a dataset from pandas dataframe

Solutions on MaxInterview for create a dataset from pandas dataframe by the best coders in the world

showing results for - "create a dataset from pandas dataframe"
Olivia
31 Sep 2018
1# azureml-core of version 1.0.72 or higher is required
2# azureml-dataprep[pandas] of version 1.1.34 or higher is required
3
4from azureml.core import Workspace, Dataset
5local_path = 'data/prepared.csv'
6dataframe.to_csv(local_path)
7
8# upload the local file to a datastore on the cloud
9
10subscription_id = 'xxxxxxxxxxxxxxxxxxxxx'
11resource_group = 'xxxxxx'
12workspace_name = 'xxxxxxxxxxxxxxxx'
13
14workspace = Workspace(subscription_id, resource_group, workspace_name)
15
16# get the datastore to upload prepared data
17datastore = workspace.get_default_datastore()
18
19# upload the local file from src_dir to the target_path in datastore
20datastore.upload(src_dir='data', target_path='data')
21
22# create a dataset referencing the cloud location
23dataset = Dataset.Tabular.from_delimited_files(path = [(datastore, ('data/prepared.csv'))])