Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No Formats Found #39

Closed
trancuuquoc opened this issue Dec 13, 2019 · 3 comments
Closed

No Formats Found #39

trancuuquoc opened this issue Dec 13, 2019 · 3 comments

Comments

@trancuuquoc
Copy link

trancuuquoc commented Dec 13, 2019

Hi Adrian,
When I run AutoCatboostCarma, I receive this error:
Error in if (min(as.ITime(data[[eval(DateCols[i])]])) - max(as.ITime(data[[eval(DateCols[i])]])) == :
missing value where TRUE/FALSE needed
In addition: Warning message:
All formats failed to parse. No formats found.
Can you help me to identify this error?
Thank you!
Quoc

@AdrianAntico
Copy link
Owner

@trancuuquoc

My guess is that one of two things are wrong:

  1. You may have not specified the TimeUnit argument correctly. I've seen this error before when I have weekly data and I accidentally specified "day" as the TimeUnit argument.
  2. The inner function CreateHolidayVariables() may not be identifying the date column as a Date or POSIXct type.

I just added in some helper code that should prevent the second error cause from occurring but it won't prevent the error of incorrectly specifying the TimeUnit argument.

@AdrianAntico
Copy link
Owner

@trancuuquoc I didn't receive any data via email. Send it to my email: adrianantico@gmail.com and I'll give it a go and see what the issue is and report back.

@AdrianAntico
Copy link
Owner

AdrianAntico commented Dec 15, 2019

@trancuuquoc

I added the fix. Should work now. You'll have to reinstall the package of course for the changes to take effect.

OLD:
if(is.character(data[[eval(DateColumnName)]])) {
    data[, eval(DateColumnName) := as.Date(get(DateColumnName))]
} else {
  data[, eval(DateColumnName) := as.POSIXct(get(DateColumnName))]
}

NEW:
if (!(tolower(TimeUnit) %chin% c("1min","5min","10min","15min","30min","hour"))) {
  if(is.character(data[[eval(DateColumnName)]])) {
    x <- data[1,get(DateColumnName)]
    x1 <- lubridate::guess_formats(x, orders = c("mdY", "BdY", "Bdy", "bdY", "bdy", "mdy", "dby", "Ymd", "Ydm"))
    data[, eval(DateColumnName) := as.Date(get(DateColumnName), tryFormats = x1)]
  }
} else {
  data[, eval(DateColumnName) := as.POSIXct(get(DateColumnName))]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants