简体   繁体   中英

how to save file into a directory by using MS azureml?

I am learning about MS azureml with this post

import azureml.dataprep as dprep
from IPython.display import display
dataset_root = "https://dprepdata.blob.core.windows.net/demo"

green_path = "/".join([dataset_root, "green-small/*"])
yellow_path = "/".join([dataset_root, "yellow-small/*"])

green_df_raw = dprep.read_csv(path=green_path, header=dprep.PromoteHeadersMode.GROUPED)
# auto_read_file automatically identifies and parses the file type, which is useful when you don't know the file type.
yellow_df_raw = dprep.auto_read_file(path=yellow_path)

display(green_df_raw.head(5))
display(yellow_df_raw.head(5))

so far, everything goes well.

when I try to save the dataframe to a directory, which is mentioned in another post .

write_t = green_df_raw.write_to_csv(directory_path=dprep.LocalFileOutput('./green.csv'))
write_t.run_local()

an error shows up

ExecutionError Traceback (most recent call last) in 1 write_t = green_df_raw.write_to_csv(directory_path=dprep.LocalFileOutput('./green.csv')) ----> 2 write_t.run_local()

~/anaconda3_501/lib/python3.6/site-packages/azureml/dataprep/api/dataflow.py in run_local(self) 357 self._engine_api.execute_anonymous_blocks(ExecuteAnonymousBlocksMessageArguments( 358 blocks=steps_to_block_datas(self._steps), --> 359 project_context=self._parent_package_path 360 )) 361

~/anaconda3_501/lib/python3.6/site-packages/azureml/dataprep/api/_aml_helper.py in wrapper(op_code, message) 36 if len(changed) > 0: 37 engine_api_func().update_environment_variable(changed) ---> 38 return send_message_func(op_code, message) 39 40 return wrapper

~/anaconda3_501/lib/python3.6/site-packages/azureml/dataprep/api/engineapi/api.py in execute_anonymous_blocks(self, message_args) 54 @update_aml_env_vars(get_engine_api) 55 def execute_anonymous_blocks(self, message_args: typedefinitions.ExecuteAnonymousBlocksMessageArguments) -> None: ---> 56 response = self._engine.send_message('Engine.ExecuteActivity', message_args) 57 return response 58

~/anaconda3_501/lib/python3.6/site-packages/azureml/dataprep/api/engineapi/engine.py in send_message(self, op_code, message) 61 response = self._read_response() 62 if 'error' in response: ---> 63 raise_engine_error(response['error']) 64 elif response.get('id') == message_id: 65 return response['result']

~/anaconda3_501/lib/python3.6/site-packages/azureml/dataprep/api/errorhandlers.py in raise_engine_error(error_response) 68 error_code = error_response['errorCode'] 69 if 'ActivityExecutionFailed' in error_code: ---> 70 raise ExecutionError(error_response) 71 elif 'UnableToPreviewDataSource' in error_code: 72 raise PreviewDataSourceError(error_response)

ExecutionError: An I/O error occurred while creating the file with the specified path.

this error is 100% reproducible on https://notebooks.azure.com .

您可以使用另一种方法final_df.save(file_path) 是我的代码。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM