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
Datetime logical type transform does not throw TypeConversionError #991
Comments
In another case a
|
What error message do we want for the |
@jeff-hernandez Thinking it should be the same as any other
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When transforming data for a specific logical type with
LogicalType.transform
, if the transformation to the correct dtype is not possible, aTypeConversionError
should be thrown. This is not currently the case with the Datetime logical type.The following code, which should produce a woodwork
TypeConversionError
produces the following error:
ValueError: Given date string not likely a datetime.
The base LogicalType class' transform catches any errors during the
astype
call and raises a TypeConversionError. The other logical types with their own transform functions might raise separate types of errors (ordinal with a data validation error, or latlong if the format does not match the required latlong format) before calling the super transform, but those are not related to the dtype change, so it makes sense that they're notTypeConversionErrors
.However with Datetime, we perform a separate astype call via the
to_datetime
function. This transformation was previously treated the same as the other dtype changes and, if an error occurred, was raised to the user as aTypeConversionError
. Now, however, we do not have a try/except around the datetime-specific logic inDatetime.transform
, so the pandas error is what we see.We should make sure that a TypeConversionError is thrown in this case.
The text was updated successfully, but these errors were encountered: