Python 读取Azure blob以获取以下错误只能将str(而不是“tuple”)连接到str?
正在尝试将azure blob数据csv文件读入数据帧。我不知道为什么我会被解雇 跟随误差Python 读取Azure blob以获取以下错误只能将str(而不是“tuple”)连接到str?,python,pandas,machine-learning,blob,azure-blob-storage,Python,Pandas,Machine Learning,Blob,Azure Blob Storage,正在尝试将azure blob数据csv文件读入数据帧。我不知道为什么我会被解雇 跟随误差 My code from azure.storage.blob import BlobClient account_url="https://example.windows.net" container_name="container1" blob_name="name" credential="abcdefh" local_file_name="downloads" #connect to blob
My code
from azure.storage.blob import BlobClient
account_url="https://example.windows.net"
container_name="container1"
blob_name="name"
credential="abcdefh"
local_file_name="downloads"
#connect to blob
blob_service = BlockBlobService(
account_name=account_url, account_key=account_key)
#This line producing error
blob_service.get_blob_to_path(container_name,blob_name,local_file_name)
#Read csv load to df
data = pd.read_csv(LOCALFILE)
我想在下面
SDK(12.0.0)
从azure.storage.blob导入BlobClient
blob=BlobClient(帐户\u url=”https://.blob.core.windows.net"
容器名称=”,
blob_name=“”,
凭证=”)
以open(“example.csv”、“wb”)作为f:
data=blob.download_blob()
数据读入(f)
我希望如下所示
SDK(12.0.0)
从azure.storage.blob导入BlobClient
blob=BlobClient(帐户\u url=”https://.blob.core.windows.net"
容器名称=”,
blob_name=“”,
凭证=”)
以open(“example.csv”、“wb”)作为f:
data=blob.download_blob()
数据读入(f)
这是我对azure.storage.blob的测试代码。假设您的问题是get\u blob\u to\u path
方法需要file\u path
参数,您可以检查该方法定义:
get_blob_to_path(
self, container_name, blob_name, file_path, open_mode='wb',
snapshot=None, start_range=None, end_range=None,
validate_content=False, progress_callback=None,
max_connections=2, lease_id=None, if_modified_since=None,
if_unmodified_since=None, if_match=None,
if_none_match=None, timeout=None, cpk=None)
这是我使用
azure.storage.blob
v2.1的测试代码。假设您的问题是get\u blob\u to\u path
方法需要file\u path
参数,您可以检查该方法定义:
get_blob_to_path(
self, container_name, blob_name, file_path, open_mode='wb',
snapshot=None, start_range=None, end_range=None,
validate_content=False, progress_callback=None,
max_connections=2, lease_id=None, if_modified_since=None,
if_unmodified_since=None, if_match=None,
if_none_match=None, timeout=None, cpk=None)
有关于这个问题的更新吗?有关于这个问题的更新吗?
import os
from azure.storage.blob import BlockBlobService
import pandas as pd
connect_str='account connection string'
block_blob_service = BlockBlobService(connection_string=connect_str)
container_name = 'test'
blob_name='test.csv'
local_file_name = blob_name
full_path_to_file = os.path.join("E:\project\pystorage", local_file_name)
block_blob_service.get_blob_to_path(container_name, local_file_name,full_path_to_file)
df=pd.read_csv(full_path_to_file)
print(df)