Azure ML Studio - 添加新列

标签 azure machine-learning data-modeling

您知道 Azure 机器学习工作室中的哪个模块允许添加新列吗?我的意思不是来自不同数据集的“复制粘贴”列,而是基于给定逻辑的新列,例如IF 语句?我想一种方法就是执行自定义 R/Python 脚本,但是有没有专用的模块?

最佳答案

您可以使用 Panda 的 DataFrame 操作来使用模块执行 Python 脚本:

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):

    # Execution logic goes here
    print('Input pandas.DataFrame #1:\r\n\r\n{0}'.format(dataframe1))


    dataframe1['new_column'] = dataframe1.apply(lambda row: extractValue(row), axis=1)

    # Return value must be of a sequence of pandas.DataFrame
    return dataframe1,


def extractValue(row):
    return 1 if row['column1'] == 'something else 2

您还可以使用执行 Python 脚本创建包含新列的新数据集,并使用添加列模块来合并它们。

关于Azure ML Studio - 添加新列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43202780/

相关文章:

azure - 如何覆盖 Azure Web App 自定义部分中的 web.config 值?

python - 不平衡数据集的分类步骤是什么?

社交网络的 SQL 建模追随者/追随者关系

machine-learning - 神经网络梯度下降中的反向传播与线性回归

python - 在Python中为XGBoost指定tree_method参数

data-modeling - 有些 snark 是 boojums : list of boojums, 或所有 snark 的 is_boojum 属性?

grails - 意外 token : mapping

wcf - 在 Azure 上的本地主机上使用 WCF

azure - 如何更改Azure虚拟机中的时区?

azure - 以原子方式将设置推送到 azure 应用程序配置