【发布时间】:2019-12-07 03:00:28
【问题描述】:
我在 AWS S3 存储桶中有一个 csv 文件。如何下载 CSV 并将其分配给 numpy 数组?
[使用python 3.6/boto3]
我尝试了各种形式,包括:
s3 = boto3.resource('s3', region_name=region)
obj = s3.Object(bucket, key)
with io.BytesIO(obj.get()["Body"].read()) as f:
# rewind the file
f.seek(0)
arr_data = numpy.load(f)
arr_data = numpy.genfromtxt('https://BUCKETNAME.s3-eu-west-1.amazonaws.com/folder/infile.csv',dtype='str',delimiter=',')
这也行不通
基本上我正在尝试在 S3 中复制: arr_data = np.genfromtxt('path...input.csv',dtype='str',delimiter=',')
【问题讨论】:
标签: numpy amazon-s3 aws-lambda