how to import POSIXct variables in a h2o data frame?Example below:> str(Test2)'data.frame': 500000 obs. of 3 variables:$ num_carte : num 4.98e+15 4.98e+15 4.98e+15 4.98e+15 4.98e+15 ...$ code_reponse: num 0 0 0 0 0 0 0 0 0 0 ...$ Date_Ok : POSIXct, format: "2015-02-11 19:41:26" "2015-02-12 19:30:32" "2015-02-13 12:19:19" "2015-02-20 15:05:25" ...> Test_h2o <- as.h2o(Test2)ERROR: Unexpected HTTP Status code: 412 Precondition Failed (url = http://localhost:54321/3/Parse)water.exceptions.H2OIllegalArgumentException[1] "water.parser.ParseSetup.strToColumnTypes(ParseSetup.java:135)"[2] "water.api.ParseHandler.parse(ParseHandler.java:14)"[3] "sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)"[4] "sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)"[5] "sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)"[6] "java.lang.reflect.Method.invoke(Method.java:497)"[7] "water.api.Handler.handle(Handler.java:64)"[8] "water.api.RequestServer.handle(RequestServer.java:644)"[9] "water.api.RequestServer.serve(RequestServer.java:585)"[10] "water.JettyHTTPD$H2oDefaultServlet.doGeneric(JettyHTTPD.java:617)"[11] "water.JettyHTTPD$H2oDefaultServlet.doPost(JettyHTTPD.java:565)"[12] "javax.servlet.http.HttpServlet.service(HttpServlet.java:755)"[13] "javax.servlet.http.HttpServlet.service(HttpServlet.java:848)"[14] "org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:684)"Error in .h2o.doSafeREST(h2oRestApiVersion = h2oRestApiVersion, urlSuffix = page, :Provided column type c("POSIXct", "POSIXt") is unknown. Cannot proceed with parse due to invalid argument.>Thanks a lot in advance!Best regards,Stéphane
Hi,
Thanks, but I want to use functions such as difftime on date-time variables, not only on date variables.
Stéphane
De : Tom Kraljevic [mailto:to...@h2o.ai]
Envoyé : mercredi 9 décembre 2015 17:43
À : Stéphane Tufféry
Cc : H2O Open Source Scalable Machine Learning - h2ostream
Objet : Re: How to import POSIXct variables in a h2o data frame
Hi Tom,
Thank you for your quick reply J
So I get something like that:
> class(Test$Date_Heure)
[1] "character"
> head(Test$Date_Heure)
[1] "2015-02-11 19:41:26" "2015-02-12 19:30:32" "2015-02-13 12:19:19" "2015-02-20 15:05:25" "2015-02-22 15:36:58"
[6] "2015-02-28 08:22:49"
> Test_h2o <- as.h2o(Test[, c("num_carte", "code_reponse", "Date_Heure")])
> head(Test_h2o)
num_carte code_reponse Date_Heure
1 4.97783e+15 0 2015-02-11 19:41:26
2 4.97783e+15 0 2015-02-12 19:30:32
3 4.97783e+15 0 2015-02-13 12:19:19
4 4.97783e+15 0 2015-02-20 15:05:25
5 4.97783e+15 0 2015-02-22 15:36:58
6 4.97783e+15 0 2015-02-28 08:22:49
>
> Test_h2o$Date_Heure[2]-Test_h2o$Date_Heure[1]
Date_Heure
1 NaN
[1 rows x 1 columns]
> Test_h2o$code_reponse[2]-Test_h2o$code_reponse[1]
code_reponse
1 0
[1 rows x 1 columns]
>
What do you mean by “H2O stores the value as a millis number”?
How can I compute the number of seconds between 2015-02-12 19:30:32 and 2015-02-11 19:41:26?
Thanks a lot!
Stéphane
De : Tom Kraljevic [mailto:to...@h2o.ai]
Envoyé : mercredi 9 décembre 2015 22:09