How to "collapse" values into a single item?
jt55401
New Altair Community Member
New user, so forgive me if this is a simple question.
I have data that looks like this:
What's the best way to turn it into this:
Help much appreciated!
Thanks
I have data that looks like this:
1234 | B |
Thanks
Tagged:
0
Answers
-
You could use the pivot operator. Here is an example:
<?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="read_csv" compatibility="5.3.008" expanded="true" height="60" name="Read CSV" width="90" x="45" y="30">
<parameter key="csv_file" value="http://pastebin.com/raw.php?i=9650xSRN"/>
<parameter key="use_quotes" value="false"/>
<parameter key="first_row_as_names" value="false"/>
<list key="annotations"/>
<list key="data_set_meta_data_information">
<parameter key="0" value="group.true.polynominal.attribute"/>
<parameter key="1" value="index.true.polynominal.attribute"/>
</list>
</operator>
<operator activated="true" class="generate_attributes" compatibility="5.3.008" expanded="true" height="76" name="Generate Attributes" width="90" x="179" y="30">
<list key="function_descriptions">
<parameter key="has" value="TRUE"/>
</list>
</operator>
<operator activated="true" class="pivot" compatibility="5.3.008" expanded="true" height="76" name="Pivot" width="90" x="313" y="30">
<parameter key="group_attribute" value="group"/>
<parameter key="index_attribute" value="index"/>
<parameter key="consider_weights" value="false"/>
<parameter key="skip_constant_attributes" value="false"/>
<parameter key="datamanagement" value="boolean_array"/>
</operator>
<operator activated="true" class="replace_missing_values" compatibility="5.3.008" expanded="true" height="94" name="Replace Missing Values" width="90" x="447" y="30">
<parameter key="default" value="value"/>
<list key="columns"/>
<parameter key="replenishment_value" value="false"/>
</operator>
<connect from_op="Read CSV" from_port="output" to_op="Generate Attributes" to_port="example set input"/>
<connect from_op="Generate Attributes" from_port="example set output" to_op="Pivot" to_port="example set input"/>
<connect from_op="Pivot" from_port="example set output" to_op="Replace Missing Values" to_port="example set input"/>
<connect from_op="Replace Missing Values" 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>0