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

Function test_from_xarray_string_conversion

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

Source from the content-addressed store, hash-verified

5351
5352
5353def test_from_xarray_string_conversion():
5354 xr = pytest.importorskip("xarray")
5355
5356 x = np.random.randn(10)
5357 y = np.arange(10, dtype="uint8")
5358 t = list("abcdefghij")
5359 ds = xr.Dataset(
5360 {"a": ("t", da.from_array(x, chunks=4)), "b": ("t", y), "t": ("t", t)}
5361 )
5362 expected_pd = pd.DataFrame({"a": x, "b": y}, index=pd.Index(t, name="t"))
5363 expected = dd.from_pandas(expected_pd, chunksize=4)
5364 actual = ds.to_dask_dataframe(set_index=True)
5365 assert isinstance(actual, dd.DataFrame)
5366 pd.testing.assert_frame_equal(actual.compute(), expected.compute())
5367
5368
5369def 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