()
| 4060 | |
| 4061 | |
| 4062 | def 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 | |
| 4089 | def test_values_extension_dtypes(): |
nothing calls this directly
no test coverage detected