【问题标题】:How to read data from S3 using python in Azure ML如何在 Azure ML 中使用 python 从 S3 读取数据
【发布时间】:2018-04-28 01:36:20
【问题描述】:
import boto3
import io
import pandas as pd

# The entry point function can contain up to two input arguments:
#   Param<dataframe1>: a pandas.DataFrame
#   Param<dataframe2>: a pandas.DataFrame
def azureml_main(dataframe1 = None, dataframe2 = None):
    s3 = boto3.client('s3',
    aws_access_key_id='REMOVED',
    aws_secret_access_key='REMOVED')
    obj = s3.get_object(Bucket='bucket', Key='data.csv000')
    df = pd.read_csv(io.BytesIO(obj['Body'].read()))
    return df,

我正在尝试使用 Execute Python 模块从 S3 读取数据。我已经下载了 boto3 包并将其转换为 zip。然后,我将该 .zip 上传并连接到模块的第三个输入选项。当我运行此代码时,我收到一条错误消息,指出未安装 botocore。有没有人能够直接从 S3 读取到 Azure ML 工作室?我试过使用 R 脚本模块,但也失败了,所以现在我正在尝试 python。

【问题讨论】:

    标签: python pandas azure dataframe azure-machine-learning-studio


    【解决方案1】:

    由于boto3包有dependencies,甚至有些是从git克隆的,我不认为Azure ML Studio可以使用它。根据documentation 中的说明,切换到Azure ML Workbench 会更容易,因为它可以更轻松地处理 Python 包。

    如果您需要使用 Azure ML Studio,另一种选择是从 S3 复制到 Azure Blob 存储,ML Studio 对此有很好的支持。

    答案不多,但恐怕你已经遇到了 Azure ML Studio 的限制。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-02-20
      • 1970-01-01
      • 2022-10-15
      • 2017-05-25
      • 1970-01-01
      • 2021-01-26
      • 2015-06-16
      相关资源
      最近更新 更多