Skip to content

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

Closed
@jorisvandenbossche

Description

@jorisvandenbossche

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions