RapidMiner 9.7 is Now Available

Lots of amazing new improvements including true version control! Learn more about what's new here.

CLICK HERE TO DOWNLOAD

Adjust Date with Attribute Value in Time Series Data [SOLVED]

GzFGzF Member Posts: 11 Contributor I
edited October 2019 in Help
Hi,

I have got some Time Series Data. The Data I have are summed up for every month. In addition a got the production date (MM.YYYY) of each device at the end of the data. The Time Series Index Attribute is calles Time.

It looks like                            
ID Time Data-Value Production-Date
1 1 XXX 01.2014
1 2 XXX 01.2014
1 3 XXX 01.2014
2 1 XXX 03.2014
2 2 XXX 03.2014
2 3 XXX 03.2014
Now, I would like to add a new attribute Correponding Month adding up the Production-Date and the Value from the Time attribute resulting in                          
ID Time Data-Value Production-Date Corresponding Month
1 1 XXX 01.2014 02.2014
1 2 XXX 01.2014 03.2014
1 3 XXX 01.2014 04.2014
2 1 XXX 03.2014 04.2014
2 2 XXX 03.2014 05.2014
2 3 XXX 03.2014 06.2014
I know how to use Adjust Date and add an integer to the Month Value. But how can I extract the integer from the Time Value
Thanks
Garf
Tagged:

Answers

  • MariusHelfMariusHelf RapidMiner Certified Expert, Member Posts: 1,869   Unicorn
    Hi Garf :)

    the date_add() function of Generate Attribute is your friend. Have a look at the process below for an example of application.

    Best!
    ~Marius
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="6.0.003">
      <context>
        <input/>
        <output/>
        <macros/>
      </context>
      <operator activated="true" class="process" compatibility="6.0.003" expanded="true" name="Process">
        <process expanded="true">
          <operator activated="true" class="generate_data_user_specification" compatibility="6.0.003" expanded="true" height="60" name="Generate Data by User Specification" width="90" x="112" y="30">
            <list key="attribute_values">
              <parameter key="delta" value="3"/>
              <parameter key="date" value="date_now()"/>
            </list>
            <list key="set_additional_roles"/>
          </operator>
          <operator activated="true" class="generate_attributes" compatibility="6.0.003" expanded="true" height="76" name="Generate Attributes" width="90" x="246" y="30">
            <list key="function_descriptions">
              <parameter key="finalDate" value="date_add(date, delta, DATE_UNIT_MONTH)"/>
            </list>
          </operator>
          <connect from_op="Generate Data by User Specification" from_port="output" to_op="Generate Attributes" to_port="example set input"/>
          <connect from_op="Generate Attributes" 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>
  • GzFGzF Member Posts: 11 Contributor I
    Hi Marius,

    that solves the Problem in a really nice way.
    Thanks a lot.
    Garf
Sign In or Register to comment.