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:5349–5362  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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