Options

[SOLVED] Transform content of one column into n columns

marcopomarcopo Member Posts: 14 Contributor II
edited November 2018 in Help
Hello Community,

the cells of one column( Abbreviations) in my repository contains multiple entries. The column is string and contains multiple abbreviations for example one cell contains (BSU MSE DFG ETS SGJ TZS). I woud love to create for every abbreviation an own column and if the row contains the abbreviation the boolean attribute will be true in the cell. Exist a possible operator?

Row    Abbreviations                            BSU         MSE       DFG     ETS     SGJ     TZS  XYZ  TSA
1         (BSU MSE DFG ETS SGJ TZS)  true           true       true     true     true     true   false   false
2         (BSU MSE DFG ETS SGJ TZS)   true           true       true     true     true     true   false   false
3         (BSU MSE DFG ETS SGJ XYZ)  true           true       true     true     true     false   true   false
4         (BSU MSE DFG ETS SGJ TSA) ) true           true       true     true     true     false  false  true

Is it possible in Rapidminer?

Thanks in advance

Answers

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

    Yes it is - here's an example that I think does what you want.
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="5.3.008">
      <context>
        <input/>
        <output/>
        <macros/>
      </context>
      <operator activated="true" class="process" compatibility="5.3.008" expanded="true" name="Process">
        <process expanded="true">
          <operator activated="true" class="generate_data_user_specification" compatibility="5.3.008" expanded="true" height="60" name="Generate Data by User Specification" width="90" x="45" y="75">
            <list key="attribute_values">
              <parameter key="abbreviations" value="&quot;AA BB DD&quot;"/>
            </list>
            <list key="set_additional_roles"/>
          </operator>
          <operator activated="true" class="generate_data_user_specification" compatibility="5.3.008" expanded="true" height="60" name="Generate Data by User Specification (3)" width="90" x="45" y="165">
            <list key="attribute_values">
              <parameter key="abbreviations" value="&quot;EE BB DD&quot;"/>
            </list>
            <list key="set_additional_roles"/>
          </operator>
          <operator activated="true" class="generate_data_user_specification" compatibility="5.3.008" expanded="true" height="60" name="Generate Data by User Specification (2)" width="90" x="45" y="255">
            <list key="attribute_values">
              <parameter key="abbreviations" value="&quot;AA BB CC EE&quot;"/>
            </list>
            <list key="set_additional_roles"/>
          </operator>
          <operator activated="true" class="append" compatibility="5.3.008" expanded="true" height="112" name="Append" width="90" x="246" y="75"/>
          <operator activated="true" class="split" compatibility="5.3.008" expanded="true" height="76" name="Split" width="90" x="380" y="75">
            <parameter key="split_pattern" value=" "/>
            <parameter key="split_mode" value="unordered_split"/>
          </operator>
          <operator activated="true" class="rename_by_replacing" compatibility="5.3.008" expanded="true" height="76" name="Rename by Replacing" width="90" x="514" y="75">
            <parameter key="replace_what" value=".*_(.*)"/>
            <parameter key="replace_by" value="$1"/>
          </operator>
          <connect from_op="Generate Data by User Specification" from_port="output" to_op="Append" to_port="example set 1"/>
          <connect from_op="Generate Data by User Specification (3)" from_port="output" to_op="Append" to_port="example set 2"/>
          <connect from_op="Generate Data by User Specification (2)" from_port="output" to_op="Append" to_port="example set 3"/>
          <connect from_op="Append" from_port="merged set" to_op="Split" to_port="example set input"/>
          <connect from_op="Split" from_port="example set output" to_op="Rename by Replacing" to_port="example set input"/>
          <connect from_op="Rename by Replacing" 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
  • Options
    marcopomarcopo Member Posts: 14 Contributor II
    Hi,

    thank you very much, Its working ;-)
Sign In or Register to comment.