P.setenum()

Read(285) Label: enumerated value, map,

Description:

The external library function (See External Library Guide) maps enumerated variable values as integers.

Syntax:

P.setenum(cn)

During modeling, map values of enumerated variable cn as integers and return a binary sequence containing the mapping result and mapping process records Rec

 

 

P.setenum@r(cn, Rec)

During scoring, map values of enumerated variable cn as integers according to mapping process records Rec

 

 

Parameter:

P

A table sequence/record sequence

cn

A string/number, which is the name of column (or the column number starting from 1) – the to-be-pre-processed variable – in a table sequence or record sequence

Rec

A sequence of mapping process records

Option:

@c

Change original data into mapping result after execution

Return value:

A sequence

Example:

 

A

 

1

=T("D://house_prices_train.csv")

Import modeling data.

2

=T("D://house_prices_test.csv")

Import scoring data.

3

=A1.setenum("MSZoning")

A3(1) Mapping result;

A3(2) Mapping process records Rec.

4

=A2.setenum@r("MSZoning",A3(2))

Map values of variable “MSZoing” in the scoring data in the same rule according to A3’s removing process records.