Skip to content

Commit 7a404a7

Browse files
update code sample for pandas-dev#43206
1 parent 054676c commit 7a404a7

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

bisect/43206.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,17 @@
2222
}
2323
)
2424

25-
df1 = df.groupby("uid", as_index=False)[["uid", "str_val", "date_val"]].apply(
25+
# df1 = df.groupby("uid", as_index=False)[["uid", "str_val", "date_val"]].apply(
26+
# lambda x: x.sort_values(by="str_val", ascending=True)
27+
# )
28+
# print(df1)
29+
30+
df2 = df.groupby("uid", as_index=False)[["uid", "str_val"]].apply(
2631
lambda x: x.sort_values(by="str_val", ascending=True)
2732
)
28-
print(df1)
33+
print(df2)
2934

3035
expected = pd.MultiIndex.from_tuples(
3136
[(0, 0), (0, 2), (1, 1), (1, 3)],
3237
)
33-
pd.testing.assert_index_equal(df1.index, expected)
38+
pd.testing.assert_index_equal(df2.index, expected)

0 commit comments

Comments
 (0)