Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/284.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 将dict保存到Azure机器学习Jupyter笔记本中的json_Python_Json_Jupyter Notebook_Azure Storage Blobs_Azure Machine Learning Service - Fatal编程技术网

Python 将dict保存到Azure机器学习Jupyter笔记本中的json

Python 将dict保存到Azure机器学习Jupyter笔记本中的json,python,json,jupyter-notebook,azure-storage-blobs,azure-machine-learning-service,Python,Json,Jupyter Notebook,Azure Storage Blobs,Azure Machine Learning Service,我在Azure机器学习工作室用Jupyter笔记本创建了一本字典: w_att={ '398465': 0, '8837.58': 1, '74967': 2, “jjpereza1”:3, '3180311358': 4, '56450': 5, '812723.990000033': 6, “瓜巴”:7} w_att length为1372600,因此当我尝试使用以下代码将对象存储在笔记本实例中时: 导入json json_object=json.dumps(w_att,indent=4)

我在Azure机器学习工作室用Jupyter笔记本创建了一本字典:

w_att={
'398465': 0,
'8837.58': 1,
'74967': 2,
“jjpereza1”:3,
'3180311358': 4,
'56450': 5,
'812723.990000033': 6,
“瓜巴”:7}
w_att length为1372600,因此当我尝试使用以下代码将对象存储在笔记本实例中时:

导入json
json_object=json.dumps(w_att,indent=4)
打印(json_对象)
我得到了这个错误:

> IOPub data rate exceeded.
> The notebook server will temporarily stop sending output
> to the client in order to avoid crashing it.
> To change this limit, set the config variable
> NotebookApp iopub_data_rate_limit.

> Current values:
> NotebookApp iopub_data_rate_limit 1000000 bytes sec
> NotebookApp rate_limit_window 3.0 secs
然后我试着:

导入azureml.core
从azureml.core导入工作区,数据存储
导入json
ws=Workspace.from_config()
datastore=datastore.get(ws,datastore_name='xxx')
datastore.upload_文件(json.dumps(w_att,indent=4),overwrite=True)
我得到了这个错误:

> IOPub data rate exceeded.
> The notebook server will temporarily stop sending output
> to the client in order to avoid crashing it.
> To change this limit, set the config variable
> NotebookApp iopub_data_rate_limit.

> Current values:
> NotebookApp iopub_data_rate_limit 1000000 bytes sec
> NotebookApp rate_limit_window 3.0 secs
UserErrorException:UserErrorException:
消息:“{”未指向文件。如果在云笔记本中运行,请先将文件上载到云。
内部异常无
错误响应
{
“错误”:{
“代码”:“用户错误”,
“消息”:“{”未指向文件。如果在云笔记本中运行,请先将文件上载到云。”
}
}
如何将对象w_att作为json文件直接保存到我的存储帐户中?

你的字典太大了——看起来笔记本服务器在试图返回所有数据时崩溃了

要将文件保存到blob中,就快到了。首先必须将文件作为实际文件保存到json对象中,然后将文件上载到数据存储。请查看如何使用Python将json保存到文件中(事实证明,这比您想象的要复杂)

导入azureml.core
从azureml.core导入工作区,数据存储
导入json
ws=Workspace.from_config()
datastore=datastore.get(ws,datastore_name='xxx')
将open('data.json','w')作为f:
dump(w_att,f,indent=4)
datastore.upload_文件('data.json',overwrite=True)