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

Function test_matmul

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

Source from the content-addressed store, hash-verified

101
102
103def test_matmul():
104 # https://github.com/pandas-dev/pandas/pull/64267
105 df = pd.DataFrame({"a": [1, 2]})
106
107 expr = pd.col("a") @ [3, 4]
108 result = df.assign(c=expr)
109 expected = pd.DataFrame({"a": [1, 2], "c": [11, 11]})
110 tm.assert_frame_equal(result, expected)
111 assert str(expr) == "col('a') @ [3, 4]"
112
113 expr = [3, 4] @ pd.col("a")
114 result = df.assign(c=expr)
115 expected = pd.DataFrame({"a": [1, 2], "c": [11, 11]})
116 tm.assert_frame_equal(result, expected)
117 assert str(expr) == "[3, 4] @ col('a')"
118
119
120def test_frame_getitem() -> None:

Callers

nothing calls this directly

Calls 2

assignMethod · 0.95
colMethod · 0.80

Tested by

no test coverage detected