MCPcopy
hub / github.com/dask/dask / test_from_xarray_string_conversion

Function test_from_xarray_string_conversion

dask/dataframe/tests/test_dataframe.py:5310–5323  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5308
5309
5310def test_from_xarray_string_conversion():
5311 xr = pytest.importorskip("xarray")
5312
5313 x = np.random.randn(10)
5314 y = np.arange(10, dtype="uint8")
5315 t = list("abcdefghij")
5316 ds = xr.Dataset(
5317 {"a": ("t", da.from_array(x, chunks=4)), "b": ("t", y), "t": ("t", t)}
5318 )
5319 expected_pd = pd.DataFrame({"a": x, "b": y}, index=pd.Index(t, name="t"))
5320 expected = dd.from_pandas(expected_pd, chunksize=4)
5321 actual = ds.to_dask_dataframe(set_index=True)
5322 assert isinstance(actual, dd.DataFrame)
5323 pd.testing.assert_frame_equal(actual.compute(), expected.compute())
5324
5325
5326def test_dataframe_into_delayed():

Callers

nothing calls this directly

Calls 3

to_dask_dataframeMethod · 0.80
arangeMethod · 0.45
computeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…