微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何在 Azure ML Studio 中运行 Python 脚本

如何解决如何在 Azure ML Studio 中运行 Python 脚本

我想通过 Python 脚本在 Azure ML Studio(经典版)中创建和使用函数

我正在尝试使用 Outgoing_three 语句创建一个名为 if 的新列。我需要一个函数,因为我需要创建几个新列。

我已经加入了“执行 Python 脚本”功能,并且有:

# The script MUST contain a function named azureml_main
# which is the entry point for this module.

# imports up here can be used to 
import pandas as pd

def azureml_main(dataframe1 = None,dataframe2 = None):

def three_class(rating):
  rating = int(rating)
  if rating <= 3:
    return 0
  elif rating >= 8:
    return 2
  else: 
    return 1

dataframe1['Outgoing_three'] = dataframe1.Outgoing.apply(three_class)
    
    # Return value must be of a sequence of pandas.DataFrame

return dataframe1,

我收到以下错误

requestId = dd391154315d44bf8968d8870ee308d7 errorComponent=模块。 任务状态代码 = 400。 {"Exception":{"ErrorId":"FailedToEvaluateScript","ErrorCode":"0085","ExceptionType":"ModuleException","Message":"Error 0085:脚本评估过程中出现以下错误,请 查看输出日志以获取更多信息:\r\n----------- 错误开始 来自 Python 解释器的消息 ----------\r\nCaught exception while 执行函数:回溯(最近一次调用最后一次):\r\n 文件 "C:\server\invokepy.py",第 189 行,批处理\r\n mod = import_module(moduleName)\r\n 文件 “C:\pyhome\lib\importlib\init.py”,第 37 行,在 import_module\r\n import名称)\r\n 文件 “C:\temp\cac4c1e87ff5435fa54d57e221c3e​​15f.py”,第 23 行\r\n def Three_class(rating):\r\n ^\r\nIndentationError: 应为缩进 阻止\r\n进程返回非零退出代码 1\r\n\r\n--------- 来自 Python 解释器的错误消息结束 ----------"}} 错误错误 0085:脚本评估过程中出现以下错误,请 查看输出日志以获取更多信息:--------- 错误开始 来自 Python 解释器的消息 ----------Caught exception while 执行函数:回溯(最近一次调用最后一次):文件 “C:\server\invokepy.py”,第 189 行,批处理模式 = import_module(moduleName) 文件 "C:\pyhome\lib\importlib_init_.py",第 37 行,在 import_module import(name) 文件中 “C:\temp\cac4c1e87ff5435fa54d57e221c3e​​15f.py”,第 23 行定义 Three_class(rating): ^IndentationError: 期望缩进 blockProcess 返回非零退出代码 1---------- 错误结束 来自 Python 解释器的消息 ---------- 进程因错误退出 代码-2

对于上述错误,我该怎么办?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。