Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pandas/core/computation/expressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
}

# the minimum prod shape that we will use numexpr
_MIN_ELEMENTS = 10000
_MIN_ELEMENTS = 1_000_000


def set_use_numexpr(v=True):
Expand Down
16 changes: 5 additions & 11 deletions pandas/tests/test_expressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ class TestExpressions:
def setup_method(self, method):

self.frame = _frame.copy()
self.array = _array.copy()
self.frame2 = _frame2.copy()
self.array2 = _array2.copy()
self.mixed = _mixed.copy()
self.mixed2 = _mixed2.copy()
self._MIN_ELEMENTS = expr._MIN_ELEMENTS
Expand Down Expand Up @@ -138,23 +136,19 @@ def test_arithmetic(self, df, flex):
self.run_frame(df, df, flex)

def test_invalid(self):
array = np.random.randn(1_000_001)
array2 = np.random.randn(100)

# no op
result = expr._can_use_numexpr(
operator.add, None, self.array, self.array, "evaluate"
)
result = expr._can_use_numexpr(operator.add, None, array, array, "evaluate")
assert not result

# min elements
result = expr._can_use_numexpr(
operator.add, "+", self.array2, self.array2, "evaluate"
)
result = expr._can_use_numexpr(operator.add, "+", array2, array2, "evaluate")
assert not result

# ok, we only check on first part of expression
result = expr._can_use_numexpr(
operator.add, "+", self.array, self.array2, "evaluate"
)
result = expr._can_use_numexpr(operator.add, "+", array, array2, "evaluate")
assert result

@pytest.mark.parametrize(
Expand Down