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

Function test_values

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

Source from the content-addressed store, hash-verified

4060
4061
4062def test_values():
4063 from dask.array.utils import assert_eq
4064
4065 df = pd.DataFrame(
4066 {"x": ["a", "b", "c", "d"], "y": [2, 3, 4, 5]},
4067 index=pd.Index([1.0, 2.0, 3.0, 4.0], name="ind"),
4068 )
4069
4070 ddf = dd.from_pandas(df, 2)
4071
4072 assert_eq(df.values, ddf.values)
4073 # When using pyarrow strings, we emit a warning about converting
4074 # pandas extension dtypes to object. Same as `test_values_extension_dtypes`.
4075 ctx = contextlib.nullcontext()
4076 if pyarrow_strings_enabled():
4077 ctx = pytest.warns(UserWarning, match="object dtype")
4078 with ctx:
4079 result = ddf.x.values
4080
4081 if not PANDAS_GE_300:
4082 # Dask currently lacks an extension type.
4083 # https://github.com/dask/dask/issues/5001
4084 assert_eq(df.x.values, result)
4085 assert_eq(df.y.values, ddf.y.values)
4086 assert_eq(df.index.values, ddf.index.values)
4087
4088
4089def test_values_extension_dtypes():

Callers

nothing calls this directly

Calls 2

assert_eqFunction · 0.90
pyarrow_strings_enabledFunction · 0.90

Tested by

no test coverage detected