date format is not recognized

marcschwmarcschw Member Posts: 4 Contributor I
edited November 2018 in Help

Hello,

 

I have imported the attached file into rapidminer and I am trying to convert the attribute "click_time" to a date_time attribute. The format of the attributes is clearly yyyy-MM-dd HH:mm:ss, but when I try to convert it I get the error "Unparseable date: '2017-11-07 09:30:38'."

Best Answer

  • BalazsBaranyBalazsBarany Administrator, Moderator, Employee, RapidMiner Certified Analyst, RapidMiner Certified Expert Posts: 955 Unicorn
    Solution Accepted

    Hi,

     

    how are you doing it?

    It worked for me with your data in two ways: Directly in the Read CSV wizard or reading the date as nominal and using Nominal to Date.

    Here's my process with both approaches. It works correctly on your data. 

    <?xml version="1.0" encoding="UTF-8"?><process version="7.6.003">
    <context>
    <input/>
    <output/>
    <macros/>
    </context>
    <operator activated="true" class="process" compatibility="7.6.003" expanded="true" name="Process">
    <process expanded="true">
    <operator activated="true" class="read_csv" compatibility="7.6.003" expanded="true" height="68" name="Read CSV" width="90" x="112" y="34">
    <parameter key="csv_file" value="/home/barany/Downloads/first100.csv"/>
    <parameter key="column_separators" value=","/>
    <parameter key="date_format" value="yyyy-MM-dd hh:mm:ss"/>
    <parameter key="first_row_as_names" value="false"/>
    <list key="annotations">
    <parameter key="0" value="Name"/>
    </list>
    <parameter key="encoding" value="UTF-16"/>
    <list key="data_set_meta_data_information">
    <parameter key="0" value="ip.true.integer.attribute"/>
    <parameter key="1" value="app.true.integer.attribute"/>
    <parameter key="2" value="device.true.integer.attribute"/>
    <parameter key="3" value="os.true.integer.attribute"/>
    <parameter key="4" value="channel.true.integer.attribute"/>
    <parameter key="5" value="click_time.true.date_time.attribute"/>
    <parameter key="6" value="attributed_time.true.attribute_value.attribute"/>
    <parameter key="7" value="is_attributed.true.integer.attribute"/>
    </list>
    </operator>
    <operator activated="true" class="read_csv" compatibility="7.6.003" expanded="true" height="68" name="Read CSV (2)" width="90" x="112" y="136">
    <parameter key="csv_file" value="/home/barany/Downloads/first100.csv"/>
    <parameter key="column_separators" value=","/>
    <parameter key="first_row_as_names" value="false"/>
    <list key="annotations">
    <parameter key="0" value="Name"/>
    </list>
    <parameter key="encoding" value="UTF-16"/>
    <list key="data_set_meta_data_information">
    <parameter key="0" value="ip.true.integer.attribute"/>
    <parameter key="1" value="app.true.integer.attribute"/>
    <parameter key="2" value="device.true.integer.attribute"/>
    <parameter key="3" value="os.true.integer.attribute"/>
    <parameter key="4" value="channel.true.integer.attribute"/>
    <parameter key="5" value="click_time.true.polynominal.attribute"/>
    <parameter key="6" value="attributed_time.true.attribute_value.attribute"/>
    <parameter key="7" value="is_attributed.true.integer.attribute"/>
    </list>
    </operator>
    <operator activated="true" class="nominal_to_date" compatibility="7.6.003" expanded="true" height="82" name="Nominal to Date" width="90" x="246" y="136">
    <parameter key="attribute_name" value="click_time"/>
    <parameter key="date_type" value="date_time"/>
    <parameter key="date_format" value="yyyy-MM-dd hh:mm:ss"/>
    </operator>
    <connect from_op="Read CSV" from_port="output" to_port="result 1"/>
    <connect from_op="Read CSV (2)" from_port="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 2"/>
    <portSpacing port="source_input 1" spacing="0"/>
    <portSpacing port="sink_result 1" spacing="0"/>
    <portSpacing port="sink_result 2" spacing="84"/>
    <portSpacing port="sink_result 3" spacing="0"/>
    </process>
    </operator>
    </process>

    Regards,

    Balázs

Answers

  • marcschwmarcschw Member Posts: 4 Contributor I

    Your process worked for me, even though I tried both of these options before. I must have messed up some of the settings (my encoding was set to SYSTEM and not UTF-16, maybe that is why). 

     

    Thank you for your help

Sign In or Register to comment.