Skip to content

BUG: operations with Offset fail for large arrays when using numexpr #40462

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

Closed
jorisvandenbossche opened this issue Mar 16, 2021 · 1 comment · Fixed by #40463
Closed

BUG: operations with Offset fail for large arrays when using numexpr #40462

jorisvandenbossche opened this issue Mar 16, 2021 · 1 comment · Fixed by #40463
Labels
Bug Frequency DateOffsets Numeric Operations Arithmetic, Comparison, and Logical operations
Milestone

Comments

@jorisvandenbossche
Copy link
Member

When surpassing the minimum number of elements threshold to use numexpr, the following operation starts to fail:

In [19]: td = pd.offsets.Day(3)

In [20]: td / pd.Series([1, 2]*5000)
Out[20]: 
0      3 days 00:00:00
1      1 days 12:00:00
             ...      
9998   3 days 00:00:00
9999   1 days 12:00:00
Length: 10000, dtype: timedelta64[ns]

In [21]: td / pd.Series([1, 2]*5001)
...
~/miniconda3/envs/dev/lib/python3.7/site-packages/numexpr/necompiler.py in getType(a)
    701     if kind == 'S':
    702         return bytes
--> 703     raise ValueError("unknown type %s" % a.dtype.name)
    704 
    705 

ValueError: unknown type object

This doesn't happen for a Timedelta object, I assume because of this check:

if should_extension_dispatch(lvalues, rvalues) or isinstance(rvalues, Timedelta):
# Timedelta is included because numexpr will fail on it, see GH#31457

@jorisvandenbossche jorisvandenbossche added Bug Numeric Operations Arithmetic, Comparison, and Logical operations labels Mar 16, 2021
@jorisvandenbossche
Copy link
Member Author

You get also several other failures when ensuring numexpr is used and running the pandas/tests/arithmetic tests (with Timestamp/datetime scalars, pd.NaT, etc)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Frequency DateOffsets Numeric Operations Arithmetic, Comparison, and Logical operations
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants