MCPcopy Create free account
hub / github.com/apache/arrow / test_pivot_wider

Function test_pivot_wider

python/pyarrow/tests/test_compute.py:4486–4509  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4484
4485
4486def test_pivot_wider():
4487 key_names = ["width", "height"]
4488
4489 result = pc.pivot_wider(["height", "width", "depth"], [10, None, 11])
4490 assert result.as_py() == {}
4491
4492 result = pc.pivot_wider(["height", "width", "depth"], [10, None, 11],
4493 key_names)
4494 assert result.as_py() == {"width": None, "height": 10}
4495 # check key order
4496 assert list(result.as_py()) == ["width", "height"]
4497
4498 result = pc.pivot_wider(["height", "width", "depth"], [10, None, 11],
4499 key_names=key_names)
4500 assert result.as_py() == {"width": None, "height": 10}
4501
4502 with pytest.raises(KeyError, match="Unexpected pivot key: depth"):
4503 result = pc.pivot_wider(["height", "width", "depth"], [10, None, 11],
4504 key_names=key_names,
4505 unexpected_key_behavior="raise")
4506
4507 with pytest.raises(ValueError, match="Encountered more than one non-null value"):
4508 result = pc.pivot_wider(["height", "width", "height"], [10, None, 11],
4509 key_names=key_names)
4510
4511
4512def test_winsorize():

Callers

nothing calls this directly

Calls 2

listFunction · 0.85
as_pyMethod · 0.80

Tested by

no test coverage detected