We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2555124 commit 59b75e6Copy full SHA for 59b75e6
bisect/42878.py
@@ -0,0 +1,17 @@
1
+# BUG: [float32 precision] pandas float32 mean is inconsistent with numpy #42878
2
+
3
+import numpy as np
4
5
+import pandas as pd
6
7
+print(pd.__version__)
8
9
+a = pd.Series(np.random.normal(scale=0.1, size=(1_000_000,)).astype(np.float32)).pow(2)
10
11
+result = np.mean(a)
12
+print(result, type(result))
13
14
+expected = np.mean(a.values)
15
+assert isinstance(result, np.float32)
16
+assert isinstance(expected, np.float32)
17
+assert result == expected
0 commit comments