在Azure ML studio中将字符串功能转换为数字时出错

问题描述 投票:1回答:1

QuotedPremium列是字符串功能,因此我需要将其转换为数值才能使用算法。

enter image description here

因此,为此,我正在使用“编辑元数据”模块,其中我指定要转换的数据类型为Floating Point

运行后-我收到一个错误:

Could not convert type System.String to type System.Double, inner exception message: Input string was not in a correct format.

enter image description here

我在这里想念什么?

azure machine-learning azure-machine-learning-studio
1个回答
0
投票

如评论中所述,您必须将将数字作为文本处理的列更改为数字类型数据,并且该列不应包含任何空值。现在回答如何使用ML studio替换数据中的NULL并将其转换为数字类型的问题。

替换数据中的NULL

为此使用Execute R Script模块,并在其中添加此代码。

dataset1 <- maml.mapInputPort(1); # class: data.frame
dataset1[dataset1 == "NULL"] = 0; # Wherever cell's value is "NULL", replace it with 0
maml.mapOutputPort("dataset1"); # return the modified data.frame

图像相同:enter image description here

转换为数字数据

正如您在答案中添加的,可以使用Edit Metadata模块来完成。

© www.soinside.com 2019 - 2024. All rights reserved.