MCPcopy Create free account
hub / github.com/dask/dask / test_meta_from_1darray

Function test_meta_from_1darray

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

Source from the content-addressed store, hash-verified

45
46
47def test_meta_from_1darray():
48 x = np.array([1.0, 2.0, 3.0], dtype=np.float64)
49 res = _meta_from_array(x)
50 assert isinstance(res, pd.Series)
51 assert res.dtype == np.float64
52
53 x = np.array([1, 2, 3], dtype=np.object_)
54 res = _meta_from_array(x, columns="x")
55 assert isinstance(res, pd.Series)
56 assert res.name == "x"
57 assert res.dtype == np.object_
58
59 x = np.array([1, 2, 3], dtype=np.object_)
60 res = _meta_from_array(x, columns=["x"])
61 assert isinstance(res, pd.DataFrame)
62 assert res["x"].dtype == np.object_
63 tm.assert_index_equal(res.columns, pd.Index(["x"]))
64
65 with pytest.raises(ValueError):
66 _meta_from_array(x, columns=["a", "b"])
67
68
69def test_meta_from_recarray():

Callers

nothing calls this directly

Calls 1

_meta_from_arrayFunction · 0.90

Tested by

no test coverage detected