我尝试了以下链接中的示例:将 Python DataFrame 作为 CSV 写入 Azure Blob但是 BlockBlobService 在 azure.storage.blob 中不再可用,因此我尝试使用 BlockBlobClient,并且可以使用以下代码创建、删除容器。但是,我找不到在容器中创建 blob 并将数据帧中的记录写入其中的方法,如上面链接中所述。请帮助我想创建一个 blob 并将数据框中的记录写入其中。
from azure.storage.blob import BlobServiceClient
blobService = BlobServiceClient.from_connection_string("**")
#blobService = BlobServiceClient(account_name=accountName, account_key=accountKey)
try:
new_container = blobService.create_container("containerfromblobservice")
properties = new_container.get_container_properties()
except ResourceExistsError:
print("Container already exists.")
Run Code Online (Sandbox Code Playgroud)