🎉 🎉 RAPIDMINER 9.10 IS OUT!!! 🎉🎉

Download the latest version helping analytics teams accelerate time-to-value for streaming and IIOT use cases.

CLICK HERE TO DOWNLOAD

Find the duration between date and average duration

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

Hi, I'm new here and also new to rapidminer. I got some question to ask for my project. It is about I need to find the duration between two dates let say "shipping date" and "received date". Is there any operator can do this calculation? I know that "Generate Attribute" operator can do many kind of calculation but I not too sure about the date. 

Answers

  • Telcontar120Telcontar120 Moderator, RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 1,625   Unicorn

    Sure, this is very easy to do inside of Generate Attributes using the "date_diff" function.   There is also a "date_now" function if you need to find the time between a given date and today.  If you look in that operator you will find them both under the "date calculation" section.  Note that the "date_diff" function returns the value in milliseconds so you will probably want to convert that (through simple division) into a more intuitive measure such as days, months, or years (depending on your data).

     

     

     

    Brian T.
    Lindon Ventures 
    Data Science Consulting from Certified RapidMiner Experts
  • rexksviirexksvii Member Posts: 4 Contributor I

    I just realized that I got a column contain with dates and time but the type is in Polynominal.

     

    I tried to use the Nominal to Date operator but I keep having an error message "Cannot Parse Date".

    The data format is like this "8/22/16 10.40". I want to convert it into format like "Aug 22, 16 10:40:00 PM SGT". I need the time as well, because I need to find the difference between time and date. 

     

    Do you have any idea how can I solve this?

     

    Thank you in advance

  • Telcontar120Telcontar120 Moderator, RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 1,625   Unicorn

    Yep, with "Nominal to Date" you have to tell it the string format that the date is being stored in.  See the operator help for information on the specifics of the date formatting in RapidMiner.  You should be able to indicate its pattern, and then it will convert and store the information as a date/time, at which point the aforementioned date difference calculation will work just fine!

     

     

    Brian T.
    Lindon Ventures 
    Data Science Consulting from Certified RapidMiner Experts
  • rexksviirexksvii Member Posts: 4 Contributor I
    Question is I know which format I need, but the parsing cannot be performed. I really got no idea on this.
  • Telcontar120Telcontar120 Moderator, RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 1,625   Unicorn

    It looks like the time portion of your record may be in a form that RapidMiner can't recognize (is this AM or PM, what is the timezone, etc).  So you have a couple of options:

    1. Use the Split operator to split the date field at the space, and create two separate attributes for date and time.  The date portion should then convert pretty easily using "nominal to date" since that is a normal date format (MM/dd/yy).  If you don't need the time difference you can then ignore that portion when calculating the date difference.
    2. If the time difference is meaningful, then you can do some separate data transformation on the time attribute (add AM/PM indicators and a timezone) until you have a format that the "nominal to date" operator can handle.  You can then get that time difference (or concatentate it back with the original date and do the conversion all in one step).

     

     

    Brian T.
    Lindon Ventures 
    Data Science Consulting from Certified RapidMiner Experts
Sign In or Register to comment.