[英]python write a dataframe as csv to azure storage account
I am able to read a csv file from Azure storage container as described here .我能描述从Azure存储容器读取csv文件在这里。
from azure.storage.blob import BlobClient
import pandas as pd
from io import StringIO
sas_url = "<your_blob_sas url>"
blob_client = BlobClient.from_blob_url(sas_url)
blob_data = blob_client.download_blob()
df = pd.read_csv(StringIO(blob_data.content_as_text()))
print(df)
Can someone help with a python code that writes the data to a storage container?有人可以帮助将数据写入存储容器的python代码吗?
I have container setup, with BLOB SAS URL我有容器设置,带有 BLOB SAS URL
I don't have account name, key or any other information, here我没有账户名,键或任何其他信息, 在这里
Have a look at BlobClient API .看看BlobClient API 。 Since you already know how to instantiate the client it's just:
由于您已经知道如何实例化客户端,因此它只是:
blob_client.upload_blob(df.to_csv(index=False))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.