|
19 | 19 | from .common import Base
|
20 | 20 |
|
21 | 21 |
|
| 22 | +def full_like(array, value): |
| 23 | + """Compatibility for numpy<1.8.0 |
| 24 | + """ |
| 25 | + ret = np.empty(array.shape, dtype=np.array(value).dtype) |
| 26 | + ret.fill(value) |
| 27 | + return ret |
| 28 | + |
| 29 | + |
22 | 30 | class Numeric(Base):
|
23 | 31 |
|
24 | 32 | def test_numeric_compat(self):
|
@@ -80,18 +88,18 @@ def test_numeric_compat(self):
|
80 | 88 | for r, e in zip(result, expected):
|
81 | 89 | tm.assert_index_equal(r, e)
|
82 | 90 |
|
83 |
| - result = divmod(idx, np.full_like(idx.values, 2)) |
| 91 | + result = divmod(idx, full_like(idx.values, 2)) |
84 | 92 | with np.errstate(all='ignore'):
|
85 |
| - div, mod = divmod(idx.values, np.full_like(idx.values, 2)) |
| 93 | + div, mod = divmod(idx.values, full_like(idx.values, 2)) |
86 | 94 | expected = Index(div), Index(mod)
|
87 | 95 | for r, e in zip(result, expected):
|
88 | 96 | tm.assert_index_equal(r, e)
|
89 | 97 |
|
90 |
| - result = divmod(idx, Series(np.full_like(idx.values, 2))) |
| 98 | + result = divmod(idx, Series(full_like(idx.values, 2))) |
91 | 99 | with np.errstate(all='ignore'):
|
92 | 100 | div, mod = divmod(
|
93 | 101 | idx.values,
|
94 |
| - np.full_like(idx.values, 2), |
| 102 | + full_like(idx.values, 2), |
95 | 103 | )
|
96 | 104 | expected = Index(div), Index(mod)
|
97 | 105 | for r, e in zip(result, expected):
|
|
0 commit comments