在 Azure ML Studio 中执行 Python 脚本模块失败

Execute Python Script Module Failing in Azure ML Studio

我在 Azure ML Studio 中使用执行 Python 脚本模块并编写了最基本的代码:

import pandas as pd
def azureml_main(dataframe1 = None, dataframe2 = None):
    dataframe1["Result"] = dataframe1["3MPurchNo"] * 3
    return dataframe1,

失败并出现以下错误:

File "C:\server\XDRReader\xdrwriter3.py", 
line 190, in write_object
raise NotImplementedError
('Python Bridge conversion table 
not implemented for type [{0}]'.format(value.getType()))
NotImplementedError: 
Python Bridge conversion table not implemented for 
type [<class 'numpy.int32'>]
Process returned with non-zero exit code 1

这似乎是 bug/feature,其中带有 int 列的数据框将无法成功返回到 ML Studio。 您可以通过将列转换为浮点类型来修复它。

import pandas as pd
def azureml_main(dataframe1 = None, dataframe2 = None):
    dataframe1["Result"] = (dataframe1["3MPurchNo"] * 3).astype(float)
    return dataframe1,

希望这对其他人有帮助