Nominal to date error in month conversion

f_lapernaf_laperna Member Posts: 13 Contributor II
edited June 2020 in Help

Hello,

I'm trying to convert some nominal attributes containing dates in format like this "yyyymmdd" (for example: 20091205 for December 5, 2009). I used the nominal to date node specifying in the "date format" parameters the format of my data.

The node execute without errors and convert values in this format: "Jan 18, 2010".

However, day and year are correct but the month is always January, for ALL the values (but numbers are different of course).

I can't understand why, can someone help me with this?

 

Thank you in advance!

 

[Following my XML]

<?xml version="1.0" encoding="UTF-8"?><process version="7.6.001">
<context>
<input/>
<output/>
<macros/>
</context>
<operator activated="true" class="process" compatibility="7.6.001" expanded="true" name="Process">
<process expanded="true">
<operator activated="true" class="retrieve" compatibility="7.6.001" expanded="true" height="68" name="Retrieve final_dataset" width="90" x="45" y="136">
<parameter key="repository_entry" value="//Local Repository/data/final_dataset"/>
</operator>
<operator activated="true" class="select_attributes" compatibility="7.6.001" expanded="true" height="82" name="Select Attributes" width="90" x="179" y="136">
<parameter key="attribute_filter_type" value="subset"/>
<parameter key="attributes" value="COD_OPE|FIN_DTIA"/>
</operator>
<operator activated="true" class="nominal_to_date" compatibility="7.6.001" expanded="true" height="82" name="Nominal to Date" width="90" x="380" y="136">
<parameter key="attribute_name" value="FIN_DTIA"/>
<parameter key="date_format" value="yyyymmdd"/>
</operator>
<connect from_op="Retrieve final_dataset" from_port="output" to_op="Select Attributes" to_port="example set input"/>
<connect from_op="Select Attributes" from_port="example set output" to_op="Nominal to Date" to_port="example set input"/>
<connect from_op="Nominal to Date" from_port="example set output" to_port="result 1"/>
<connect from_op="Nominal to Date" from_port="original" to_port="result 2"/>
<portSpacing port="source_input 1" spacing="0"/>
<portSpacing port="sink_result 1" spacing="0"/>
<portSpacing port="sink_result 2" spacing="0"/>
<portSpacing port="sink_result 3" spacing="0"/>
</process>
</operator>
</process>

Best Answer

  • earmijoearmijo Member Posts: 270 Unicorn
    Solution Accepted

    In date format try: yyyyMMdd. 'mm' means minutes.

Answers

  • Edin_KlapicEdin_Klapic Moderator, Employee, RMResearcher, Member Posts: 299 RM Data Scientist

    Hi @f_laperna,

     

    More information regarding the available date format patterns can be found in the Help text of the respective Operator.

    Either within RapidMiner Studio or on the website https://docs.rapidminer.com/studio/operators/blending/attributes/types/nominal_to_date.html.

     

    Best regards,

    Edin

  • f_lapernaf_laperna Member Posts: 13 Contributor II

    Yeah, sure. This was certainly the reason why it read January for all the records.

    But unfortunately now I get an error "Cannot parse date", but the date format is right.

     

    EDIT: By changing the Time-zone and Locale I've been able to achieve what I wanted. So now it works. Thank you and sorry for the stupid question.

  • earmijoearmijo Member Posts: 270 Unicorn

    Are you sure date was read as 'polynominal' and not integer? If it was edit the dataset and change the attribute type to 'polynominal' and run the program again.

Sign In or Register to comment.