MCPcopy
hub / github.com/dask/dask / test_from_array

Function test_from_array

dask/dataframe/io/tests/test_io.py:89–104  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

87
88
89def 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
107def test_from_array_with_record_dtype():

Callers

nothing calls this directly

Calls 5

reshapeMethod · 0.80
arangeMethod · 0.45
allMethod · 0.45
computeMethod · 0.45
onesMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…