Options

Rename operator

Legacy UserLegacy User Member Posts: 0 Newbie
edited November 2018 in Help
Hello,

I have a Read CSV operator, and the data source is: http://archive.ics.uci.edu/ml/machine-learning-databases/blood-transfusion/transfusion.data
Ok, now i wanna use a Rename operator, to rename those attributes.. if you run the process you'll see that the 1st attribute, for example is Recency (months), then Frequency (times) and so on..
But i cannot use the rename attribute.. i cannot specify the old name, and to provide a new name. WHY? I need to rename because i wanna use a Write database operator, and the attribute names are the columns of the database table.

Some ideas?
Thanks

Answers

  • Options
    awchisholmawchisholm RapidMiner Certified Expert, Member Posts: 458 Unicorn
    Hello

    It often looks like it won't work because the metadata has got lost but if you simply enter the name of the attributes manually, you can get what you want.

    Here's an example
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="5.1.006">
      <context>
        <input/>
        <output/>
        <macros/>
      </context>
      <operator activated="true" class="process" compatibility="5.1.006" expanded="true" name="Process">
        <process expanded="true" height="618" width="1119">
          <operator activated="true" class="read_csv" compatibility="5.1.006" expanded="true" height="60" name="Read CSV" width="90" x="45" y="30">
            <parameter key="csv_file" value="http://archive.ics.uci.edu/ml/machine-learning-databases/blood-transfusion/transfusion.data"/>
            <parameter key="column_separators" value=","/>
            <list key="annotations"/>
            <list key="data_set_meta_data_information"/>
          </operator>
          <operator activated="true" class="rename" compatibility="5.1.006" expanded="true" height="76" name="Rename" width="90" x="179" y="30">
            <parameter key="old_name" value="Recency (months)"/>
            <parameter key="new_name" value="recency"/>
            <list key="rename_additional_attributes">
              <parameter key="Frequency (times)" value="frequency"/>
              <parameter key="Monetary (c.c. blood)" value="monetary"/>
              <parameter key="Time (months)" value="time"/>
              <parameter key="whether he/she donated blood in March 2007" value="whether"/>
            </list>
          </operator>
          <connect from_op="Read CSV" from_port="output" to_op="Rename" to_port="example set input"/>
          <connect from_op="Rename" 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>
    regards

    Andrew
Sign In or Register to comment.