Skip to content

Commit b9f0344

Browse files
add code sample for pandas-dev#36003
1 parent 25985f7 commit b9f0344

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

bisect/36003.py

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import datetime
2+
3+
import pandas as pd
4+
import pandas.testing as tm
5+
6+
print(pd.__version__)
7+
8+
9+
df = pd.DataFrame(
10+
{
11+
"A": ["X", "Y"],
12+
"B": [
13+
datetime.datetime(2005, 1, 1, 10, 30, 23, 540000),
14+
datetime.datetime(3005, 1, 1, 10, 30, 23, 540000),
15+
],
16+
}
17+
)
18+
print(df)
19+
20+
print(df.dtypes)
21+
22+
result = df.groupby("A").B.max()
23+
print(result)
24+
25+
expected = pd.Series(
26+
[
27+
pd.Timestamp("2005-01-01 10:30:23.540000"),
28+
datetime.datetime(3005, 1, 1, 10, 30, 23, 540000),
29+
],
30+
index=pd.Index(["X", "Y"], dtype="object", name="A"),
31+
name="B",
32+
)
33+
34+
tm.assert_series_equal(result, expected)

0 commit comments

Comments
 (0)