-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: make TablesClient.predict permissive to input data types (#13)
* fix: make TablesClient.predict permissive to input data types The current implementation checks input instance's data type according to column spec's data type. E.g., if the column spec is float, it requires the input to be float or int, but not string. However, this is not the same as tables API contract: float column data type could be string or number values. The current code raises exception with error messages like TypeError: '0' has type str, but expected one of: int, long, float when passed in a string value for numeric columns, which should be allowed. This PR changes the logic so that Python SDK side will be permissive for the input data type - basically all JSON compatible data types are allow. And rely on backend for the validation. * Fix according to comment. * Fix lint. * Address comment: use elif instead of if Co-authored-by: Helin Wang <helin@google.com>
- Loading branch information
Showing
1 changed file
with
60 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters