| 87 | |
| 88 | |
| 89 | def test_from_array(): |
| 90 | x = np.arange(10 * 3).reshape(10, 3) |
| 91 | d = dd.from_array(x, chunksize=4) |
| 92 | assert isinstance(d, dd.DataFrame) |
| 93 | tm.assert_index_equal(d.columns, pd.Index([0, 1, 2])) |
| 94 | assert d.divisions == (0, 4, 8, 9) |
| 95 | assert (d.compute().values == x).all() |
| 96 | |
| 97 | d = dd.from_array(x, chunksize=4, columns=list("abc")) |
| 98 | assert isinstance(d, dd.DataFrame) |
| 99 | tm.assert_index_equal(d.columns, pd.Index(["a", "b", "c"])) |
| 100 | assert d.divisions == (0, 4, 8, 9) |
| 101 | assert (d.compute().values == x).all() |
| 102 | |
| 103 | with pytest.raises(ValueError): |
| 104 | dd.from_array(np.ones(shape=(10, 10, 10))) |
| 105 | |
| 106 | |
| 107 | def test_from_array_with_record_dtype(): |