|
30 | 30 |
|
31 | 31 | import pandas.computation.expr as expr |
32 | 32 | import pandas.util.testing as tm |
| 33 | +import pandas.lib as lib |
33 | 34 | from pandas.util.testing import (assert_frame_equal, randbool, |
34 | 35 | assertRaisesRegexp, assert_numpy_array_equal, |
35 | 36 | assert_produces_warning, assert_series_equal) |
@@ -196,7 +197,7 @@ def check_complex_cmp_op(self, lhs, cmp1, rhs, binop, cmp2): |
196 | 197 | ex = '(lhs {cmp1} rhs) {binop} (lhs {cmp2} rhs)'.format(cmp1=cmp1, |
197 | 198 | binop=binop, |
198 | 199 | cmp2=cmp2) |
199 | | - scalar_with_in_notin = (np.isscalar(rhs) and (cmp1 in skip_these or |
| 200 | + scalar_with_in_notin = (lib.isscalar(rhs) and (cmp1 in skip_these or |
200 | 201 | cmp2 in skip_these)) |
201 | 202 | if scalar_with_in_notin: |
202 | 203 | with tm.assertRaises(TypeError): |
@@ -327,7 +328,7 @@ def check_pow(self, lhs, arith1, rhs): |
327 | 328 | expected = self.get_expected_pow_result(lhs, rhs) |
328 | 329 | result = pd.eval(ex, engine=self.engine, parser=self.parser) |
329 | 330 |
|
330 | | - if (np.isscalar(lhs) and np.isscalar(rhs) and |
| 331 | + if (lib.isscalar(lhs) and lib.isscalar(rhs) and |
331 | 332 | _is_py3_complex_incompat(result, expected)): |
332 | 333 | self.assertRaises(AssertionError, tm.assert_numpy_array_equal, |
333 | 334 | result, expected) |
@@ -360,16 +361,16 @@ def check_compound_invert_op(self, lhs, cmp1, rhs): |
360 | 361 | skip_these = 'in', 'not in' |
361 | 362 | ex = '~(lhs {0} rhs)'.format(cmp1) |
362 | 363 |
|
363 | | - if np.isscalar(rhs) and cmp1 in skip_these: |
| 364 | + if lib.isscalar(rhs) and cmp1 in skip_these: |
364 | 365 | self.assertRaises(TypeError, pd.eval, ex, engine=self.engine, |
365 | 366 | parser=self.parser, local_dict={'lhs': lhs, |
366 | 367 | 'rhs': rhs}) |
367 | 368 | else: |
368 | 369 | # compound |
369 | | - if np.isscalar(lhs) and np.isscalar(rhs): |
| 370 | + if lib.isscalar(lhs) and lib.isscalar(rhs): |
370 | 371 | lhs, rhs = map(lambda x: np.array([x]), (lhs, rhs)) |
371 | 372 | expected = _eval_single_bin(lhs, cmp1, rhs, self.engine) |
372 | | - if np.isscalar(expected): |
| 373 | + if lib.isscalar(expected): |
373 | 374 | expected = not expected |
374 | 375 | else: |
375 | 376 | expected = ~expected |
@@ -639,17 +640,17 @@ def test_identical(self): |
639 | 640 | x = 1 |
640 | 641 | result = pd.eval('x', engine=self.engine, parser=self.parser) |
641 | 642 | self.assertEqual(result, 1) |
642 | | - self.assertTrue(np.isscalar(result)) |
| 643 | + self.assertTrue(lib.isscalar(result)) |
643 | 644 |
|
644 | 645 | x = 1.5 |
645 | 646 | result = pd.eval('x', engine=self.engine, parser=self.parser) |
646 | 647 | self.assertEqual(result, 1.5) |
647 | | - self.assertTrue(np.isscalar(result)) |
| 648 | + self.assertTrue(lib.isscalar(result)) |
648 | 649 |
|
649 | 650 | x = False |
650 | 651 | result = pd.eval('x', engine=self.engine, parser=self.parser) |
651 | 652 | self.assertEqual(result, False) |
652 | | - self.assertTrue(np.isscalar(result)) |
| 653 | + self.assertTrue(lib.isscalar(result)) |
653 | 654 |
|
654 | 655 | x = np.array([1]) |
655 | 656 | result = pd.eval('x', engine=self.engine, parser=self.parser) |
|
0 commit comments