[英]Saving a file into Azure Blob storage
I am running a Python code on Azure Machine Learning platform/cloud and I cannot figure out how to save a resulting dataframe into a csv file in the Azure Blob Storage. I am running a Python code on Azure Machine Learning platform/cloud and I cannot figure out how to save a resulting dataframe into a csv file in the Azure Blob Storage. Can someone tell me how to do it or point me where I could read more about it?有人可以告诉我该怎么做或指出我可以在哪里阅读更多相关信息吗?
Can you try uploading the file to Azure blog using below python code:您可以尝试使用以下 python 代码将文件上传到 Azure 博客:
global service_client
service_client = DataLakeServiceClient(account_url="{}://{}.dfs.core.windows.net".format("https", 'Storage_account_name'), credential='Storage_Account_Key')
#upload file to ADLS Gen 2
file_system_client = service_client.get_file_system_client(file_system="your_container_name")
directory_client = file_system_client.get_directory_client("my-directory")
file_client = directory_client.create_file("uploaded-file.txt")
local_file = open("C:\\Users\\xxxxxxx\\Desktop\\testFile.txt", 'r')
file_contents = local_file.read()
file_client.append_data(data=file_contents, offset=0, length=len(file_contents))
file_client.flush_data(len(file_contents))
For more details to the complete code, visit this link有关完整代码的更多详细信息,请访问此链接
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.