unparsable time

roya67roya67 Member Posts: 10 Contributor II
edited November 2018 in Help
hi every body.
I am new in rapidminer, and I have problem loading my data to rapidminer by ReadExcell, I will appreciate if anyone help me.
I have a colomn named time. and it has data that are in time format : for example : 01:00:46.644337
rapidminer uses polynomial type for that automaticaly, I changed it to time but I got the error unparsable time. :
what can I do to solve this problem.

thanks alot.

Answers

  • chrismxnrchrismxnr Member Posts: 12 Contributor II
    Hi,
    I also have some problems with the time handling in RapidMiner, especially when I extracted it with a macro and then writing it back as date. So I can maybe give you an idea for an workaround:

    My approach would be this: You should be able to read the date as nominal value. Then with the "Generate Attributes"-operator you can generate a new attribute using the function "date_parse_custom", which uses your nominal date and an additional Pattern String as Input according to your format (I think it should be "HH:mm:ss.ffffff"). As result the new attribute should contain your value as date/time.

    Best regards,
    Chris
  • roya67roya67 Member Posts: 10 Contributor II
    thanks alot :)
    I'm going to try this.
  • roya67roya67 Member Posts: 10 Contributor II
    dear chris
    I have problem using the method you mentioned.
    I use date_parse_custom(time,"HH:mm:ss.ffffff") under the function operation but get a strange error. am I wrong?

    then I tried this method like this :(time,"HH:mm:ss")  and had to remove that part. this way I didn't get error but it shows date in the colomn. what can I do to see only time.
    although I used DATE_SHOW_TIME_ONLY  constant as the third argument it did not change
    date_parse_custom(time,"HH:mm:ss","DATE_SHOW_TIME_ONLY ")
    thank you very much
  • chrismxnrchrismxnr Member Posts: 12 Contributor II
    Hi,
    if you enter a string you have to put it into quatation marks, so please try date_parse_custom(time,"HH:mm:ss.ffffff").

    I hope this will solve your problem :)

    Chris
  • roya67roya67 Member Posts: 10 Contributor II
    hi,
    thank you, I tried that, and I editted my post. would you please take a look at it again
  • chrismxnrchrismxnr Member Posts: 12 Contributor II
    I'm sorry, here I don't know what to do, because in my cases I didn't work with milliseconds and I had full dates. My only idea would be to use the operator "Guess Types" afterwards, but I'm not sure if it will recognize that it's not a date but just time...

    I wish you much luck solving your problem anyway.

    Best regards,
    Chris
  • roya67roya67 Member Posts: 10 Contributor II
    thanks for your reply.
    actually, I have one column that is just time , and another column that is just date, and I don't have any problem with the date column, it's type is recognized automatically to date-time, and when I change it to date there is no problem,. can I do something to combine these two columns to have one date-time column?
    I really appreciate your time. sorry for asking continues questions. I have to do this project, and there is little time . :'(
  • IngoRMIngoRM Administrator, Moderator, Employee, RapidMiner Certified Analyst, RapidMiner Certified Expert, Community Manager, RMResearcher, Member, University Professor Posts: 1,751 RM Founder
    Hi,

    yes, you could first use both attributes with value type "nominal" (or transform them first, see below), then you can simple use the operator "Generate Concatenation" to combine both columns. Instead of using "Generate Attributes" and the data_parse functions, you could also use the probably simpler operators "Nominal to Date" and "Date to Nominal" instead, which can also handle times. I have uploaded a process to myexperiment.org demonstrating the desired time and date conversions, you can simply download it with the "Community" extension of RapidMiner:

    http://www.myexperiment.org/workflows/2596.html

    The main problem might derive from the fact that "01:00:46.644337" is not a proper date at all: "644337" milliseconds do not make any sense at all. If the time would only be "01:00:46.644" things are pretty easy (as the process above shows), here the correct parse string would be "hh:mm:ss.SSS" and all methods will be able to parse the time correctly. Please note, however, that RapidMiner will not display the milliseconds for time attributes but it still stores the information as can be seen after the re-transforming with "Date to Nominal" in the process above.

    Cheers,
    Ingo
  • roya67roya67 Member Posts: 10 Contributor II
    Thanks a lot  :)
    I got the main point, I'm going to try that. I may encounter some problems, and may ask you kind people again.
    I may have to work more, because I don't know about Gen.data and replace.
    I load my data by ReadExcell.
  • roya67roya67 Member Posts: 10 Contributor II
    http://www.4shared.com/photo/gN0erq11/1_online.html

    http://www.4shared.com/photo/EbL9wFdN/2_online.html
    http://www.4shared.com/photo/HPfSthFM/3_online.html




    sorry, would you please take a look at this image..
    I have put the first Nominal to date for the column date in my data. and the second for the time column in my data. I have already removed the millisecond part of the time.
    the third operator(Date to Nominal) I have placed there is for combining these two columns to one date-time attribute.
    I don't know what to set data format and attribute name there
    and I don't know how to do the setting for data format, in these three operators.

    thanks for your help
  • chrismxnrchrismxnr Member Posts: 12 Contributor II
    @Ingo Mierswa : Oh yes, there is a direct nominal to date operator. In my cases I never had to use that, so sorry for my more complicated way ;).

    @roya67: I'm not exactly sure what you want to get, but you should use the "Generate Concatenation" Operator without converting the attributes to date. Then you should get a nominal value showing your full date with time. If you want to have a date attribute in the end, then you should convert it with the "Nominal to Date" Operator afterwards in one step including date and time. So I think you can do it with just these two operators....

    Chris
  • roya67roya67 Member Posts: 10 Contributor II
    Tahnks alot. my problem solved with the help of you. I appreciate your time. both of you  :)
Sign In or Register to comment.