MCPcopy Index your code
hub / github.com/dask/dask / test_mask_where_array_like

Function test_mask_where_array_like

dask/dataframe/tests/test_dataframe.py:5165–5186  ·  view source on GitHub ↗

DataFrame.mask fails for single-row partitions https://github.com/dask/dask/issues/9848

(df, cond)

Source from the content-addressed store, hash-verified

5163 ],
5164)
5165def test_mask_where_array_like(df, cond):
5166 """DataFrame.mask fails for single-row partitions
5167 https://github.com/dask/dask/issues/9848
5168 """
5169 ddf = dd.from_pandas(df, npartitions=2)
5170
5171 # ensure raises when list is provided
5172 with pytest.raises(ValueError, match="can be aligned|shape"):
5173 ddf.mask(cond=cond, other=5)
5174
5175 with pytest.raises(ValueError, match="can be aligned|shape"):
5176 ddf.where(cond=cond, other=5)
5177
5178 # but works when DataFrame is provided, with matching index
5179 dd_cond = pd.DataFrame(cond, index=df.index, columns=df.columns)
5180 expected = df.mask(cond=cond, other=5)
5181 result = ddf.mask(cond=dd_cond, other=5)
5182 assert_eq(expected, result)
5183
5184 expected = df.where(cond=cond, other=5)
5185 result = ddf.where(cond=dd_cond, other=5)
5186 assert_eq(expected, result)
5187
5188
5189def test_mask_where_callable():

Callers

nothing calls this directly

Calls 3

assert_eqFunction · 0.90
maskMethod · 0.45
whereMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…