How to change an information of an attribute?
Hi Experts,
Hi Experts,
I'm starting to work with rapidminer and I need your help.
I've an database with 23 attributes and I need to change the information of attribute "outcome". This attribute "outcome" has the informations "Lived", "Died" and "Euthanized", in others words, after I read the csv file I'll need treat the database changing the informations of attribute "outcome".
I would like to change all information equal "Euthanized" to "Died". What operetors can I use?
Thanks in advance my friends.
Marcelo Batista
Best Answer
-
Pavithra_Rao Employee, RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 123 RM Data Scientist
You could easily achieve this using Replace Operator as shown below.
Replace operator
Below is the XML of the sample process for the same. Also here is how to Import XML-code to process
Hope this helps,
Cheers,
<?xml version="1.0" encoding="UTF-8"?><process version="8.1.001">
<context>
<input/>
<output/>
<macros/>
</context>
<operator activated="true" class="process" compatibility="8.1.001" expanded="true" name="Process">
<process expanded="true">
<operator activated="true" breakpoints="after" class="operator_toolbox:create_exampleset_from_doc" compatibility="0.9.000" expanded="true" height="68" name="Create ExampleSet" width="90" x="112" y="85">
<parameter key="Input Csv" value="Outcome Lived Died Euthanized"/>
</operator>
<operator activated="true" class="set_role" compatibility="8.1.001" expanded="true" height="82" name="Set Role" width="90" x="313" y="85">
<parameter key="attribute_name" value="Outcome"/>
<parameter key="target_role" value="label"/>
<list key="set_additional_roles"/>
</operator>
<operator activated="true" class="replace" compatibility="8.1.001" expanded="true" height="82" name="Replace" width="90" x="782" y="34">
<parameter key="attribute_filter_type" value="single"/>
<parameter key="attribute" value="Outcome"/>
<parameter key="include_special_attributes" value="true"/>
<parameter key="replace_what" value="Euthanized"/>
<parameter key="replace_by" value="Died"/>
</operator>
<connect from_op="Create ExampleSet" from_port="output" to_op="Set Role" to_port="example set input"/>
<connect from_op="Set Role" from_port="example set output" to_op="Replace" to_port="example set input"/>
<connect from_op="Replace" from_port="example set output" to_port="result 1"/>
<portSpacing port="source_input 1" spacing="0"/>
<portSpacing port="sink_result 1" spacing="0"/>
<portSpacing port="sink_result 2" spacing="0"/>
</process>
</operator>
</process>1