Skip to content

Commit f6c2d0d

Browse files
code sample for pandas-dev#42452
1 parent 61620c7 commit f6c2d0d

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

bisect/42452.py

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# BUG: pandas EWM fails silently if data types are float32 instead of float64 #42452
2+
3+
import numpy as np
4+
5+
import pandas as pd
6+
from pandas import DataFrame
7+
import pandas._testing as tm
8+
9+
print(pd.__version__)
10+
11+
float_dtype = np.float32
12+
df = DataFrame({"A": range(5), "B": range(10, 15)}, dtype=float_dtype)
13+
14+
result = df.rolling(2, axis=1).sum()
15+
print(result)
16+
17+
expected = DataFrame({"A": [np.nan] * 5, "B": range(10, 20, 2)}, dtype=float_dtype)
18+
tm.assert_frame_equal(result, expected, check_dtype=False)

0 commit comments

Comments
 (0)