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

Remove the errors='ignore' argument to ensure code can be jittable #8

Open
ehariri opened this issue Jun 30, 2022 · 0 comments
Open

Comments

@ehariri
Copy link
Contributor

ehariri commented Jun 30, 2022

For several APIs, the errors argument can be used to control what happens when an operation is not successful. For example,pandas.to_datetime allows errors for handling a failed conversion: pandas.to_datetime — pandas 1.4.2 documentation . While both raise and coerce are JIT compatible, the ignore option is not because it can lead to inconsistent types.

>>> arr = ["2/21/2022", "123"]
>>> pd.to_datetime(arr, errors="ignore")
Index(['2/21/2022', '123'], dtype='object')

>>> arr = ["2/21/2022", "1/1/2011"]
>>> pd.to_datetime(arr, errors="ignore")
DatetimeIndex(['2022-02-21', '2011-01-01'], dtype='datetime64[ns]', freq=None)

Here as you can see, the output dtype is dependent entirely the runtime values of arr, meaning for arguments with particular input types you cannot predict the output type. We would like to see this option removed from all Pandas APIs because it fundamentally makes it impossible to JIT compile this code.

@ehsantn ehsantn changed the title Deprecate the errors='ignore' argument to ensure code can be JITable Remove the errors='ignore' argument to ensure code can be JITable Jun 30, 2022
@ehsantn ehsantn changed the title Remove the errors='ignore' argument to ensure code can be JITable Remove the errors='ignore' argument to ensure code can be jittable Jun 30, 2022
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

1 participant