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

Function test_property

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

Source from the content-addressed store, hash-verified

286
287
288def test_property() -> None:
289 # https://github.com/pandas-dev/pandas/pull/63439
290 df = pd.DataFrame({"a": [1, 2, 3]})
291 expr = pd.col("a").index
292 expected_str = "col('a').index"
293
294 assert str(expr) == expected_str
295
296 result = df.assign(b=expr)
297 expected = pd.DataFrame({"a": [1, 2, 3], "b": [0, 1, 2]})
298 tm.assert_frame_equal(result, expected)
299
300
301def test_cached_property() -> None:

Callers

nothing calls this directly

Calls 2

assignMethod · 0.95
colMethod · 0.80

Tested by

no test coverage detected