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

Function test_expression_getitem

pandas/tests/test_col.py:275–285  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

273
274
275def test_expression_getitem() -> None:
276 # https://github.com/pandas-dev/pandas/pull/63439
277 df = pd.DataFrame({"a": [1, 2, 3]})
278 expr = pd.col("a")[1]
279 expected_str = "col('a')[1]"
280
281 assert str(expr) == expected_str
282
283 result = df.assign(b=expr)
284 expected = pd.DataFrame({"a": [1, 2, 3], "b": [2, 2, 2]})
285 tm.assert_frame_equal(result, expected)
286
287
288def test_property() -> None:

Callers

nothing calls this directly

Calls 2

assignMethod · 0.95
colMethod · 0.80

Tested by

no test coverage detected