Skip to content

Commit 3089d1a

Browse files
code sample for pandas-dev#43292
1 parent 1e4e380 commit 3089d1a

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

bisect/43292.py

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# BUG: inconsistent result when groupby then sum values that contain inf #43292
2+
3+
import numpy as np
4+
import pandas as pd
5+
6+
print(pd.__version__)
7+
8+
df = pd.DataFrame(
9+
{"a": ["hello", "hello", "world", "world"], "b": [np.inf, 10, np.nan, 10]}
10+
)
11+
12+
gb = df.groupby("a")
13+
result = gb.sum()
14+
print(result)
15+
16+
assert result.loc["hello", "b"] == np.inf, result.loc["hello", "b"]

0 commit comments

Comments
 (0)