Skip to content

Commit f62ef8c

Browse files
code sample for pandas-dev#40018
1 parent 398ec4c commit f62ef8c

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

bisect/40018.py

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import pandas as pd
2+
import pandas.testing as tm
3+
4+
print(pd.__version__)
5+
6+
df = pd.DataFrame({"a": [1, 2], "b": [1, 4], "c": [1, 4]})
7+
8+
res = df.transform({"b": ["sqrt", "abs"], "c": "sqrt"})
9+
print(res)
10+
11+
expected = pd.MultiIndex.from_tuples(
12+
[("b", "sqrt"), ("b", "abs"), ("c", "sqrt")],
13+
)
14+
15+
tm.assert_index_equal(res.columns, expected)

0 commit comments

Comments
 (0)