如何使用MS Azureml将文件保存到目录中?

时间:2019-03-26 13:39:42

标签: python machine-learning

我正在通过post

了解MS azureml
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))

到目前为止,一切顺利。

当我尝试将数据框保存到另一个post中提到的目录时。

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

显示错误

  

ExecutionError追溯(最近的呼叫   最后)         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   在run_local()       第357章       358个数据块= 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   在包装器中(op_code,消息)        如果len(changed)> 0则为36:        37 engine_api_func()。update_environment_variable(已更改)   ---> 38返回send_message_func(op_code,message)        39        40个返回包装纸

     

〜/ anaconda3_501 / lib / python3.6 / site-packages / azureml / dataprep / api / engineapi / api.py在execute_anonymous_blocks(self,message_args)中        54 @update_aml_env_vars(get_engine_api)        55 def execute_anonymous_blocks(self,message_args:typedefinitions.ExecuteAnonymousBlocksMessageArguments)->无:   ---> 56响应= self._engine.send_message('Engine.ExecuteActivity',message_args)        57回复        58

     

〜/ anaconda3_501 / lib / python3.6 / site-packages / azureml / dataprep / api / engineapi / engine.py   在send_message中(自己,op_code,消息)        61响应= self._read_response()        62如果响应为“错误”:   ---> 63 raise_engine_error(response ['error'])        64 elif response.get('id')== message_id:        65返回响应['result']

     

〜/ anaconda3_501 / lib / python3.6 / site-packages / azureml / dataprep / api / errorhandlers.py在raise_engine_error(error_response)中        68 error_code = error_response ['errorCode']        69如果error_code中的“ ActivityExecutionFailed”:   ---> 70引发ExecutionError(error_response)        71 elif'UnableToPreviewDataSource'在error_code中:        72引发PreviewDataSourceError(error_response)

     

ExecutionError:使用以下命令创建文件时发生I / O错误:   指定的路径。

此错误在https://notebooks.azure.com上可100%重现。

1 个答案:

答案 0 :(得分:2)

您可以使用另一种方法final_df.save(file_path) Here是我执行此操作的代码。