MLServer
MLServer copied to clipboard
Fix pandas codec nan conversion for non-numeric columns
Description
This changes fixes a bug in the PandasCodec to_response_output conversion function which raises the following error when null values are attempted to be checked as nan values using numpy.isnan(x). This can occur in cases such as a string series with nullable entries.
TypeError: ufunc 'isnan' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''
Changes Made
- Update
PandasCodecResponseOutputmapper to skip nan conversion for BYTES column- This change mirrors the behavior present in
NumpyCodec
- This change mirrors the behavior present in
- Update
PandasCodecstring content type detection to ignore null values in an otherwise string column
Related Issues
- https://github.com/SeldonIO/MLServer/issues/1873
- https://github.com/SeldonIO/MLServer/issues/1747#issuecomment-2411056443
Screenshots (if applicable)
N/A
Checklist
- [x] Code follows the project's style guidelines
- [x] All tests related to the changes pass successfully
- [x] Documentation is updated (if necessary)
- [ ] Code is reviewed by at least one other team member
- [ ] Any breaking changes are communicated and documented
Additional Notes
N/A