MCPcopy
hub / github.com/pandas-dev/pandas / test_col_logical_ops

Function test_col_logical_ops

pandas/tests/test_col.py:253–272  ·  view source on GitHub ↗
(
    expr: Expression, expected_values: list[bool], expected_str: str
)

Source from the content-addressed store, hash-verified

251 ],
252)
253def test_col_logical_ops(
254 expr: Expression, expected_values: list[bool], expected_str: str
255) -> None:
256 # https://github.com/pandas-dev/pandas/issues/63322
257 df = pd.DataFrame({"a": [True, False, True, False], "b": [False, True, True, True]})
258 result = df.assign(c=expr)
259 expected = pd.DataFrame(
260 {
261 "a": [True, False, True, False],
262 "b": [False, True, True, True],
263 "c": expected_values,
264 }
265 )
266 tm.assert_frame_equal(result, expected)
267 assert str(expr) == expected_str
268
269 # Test that the expression works with .loc
270 result = df.loc[expr]
271 expected = df[expected_values]
272 tm.assert_frame_equal(result, expected)
273
274
275def test_expression_getitem() -> None:

Callers

nothing calls this directly

Calls 1

assignMethod · 0.95

Tested by

no test coverage detected