-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
Add test to check numeric precision GH33234 #51753
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
689ae3d
to
23a03df
Compare
else 2147483647 | ||
], | ||
} | ||
).astype({"key3": dtype}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you define all those objects explicitly? e.g. no astype
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. Could I drop the astype part and keep just DataFrame creation expression?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I defined all those objects explicitly in the updated commit.
92a9b7b
to
cb38b93
Compare
"Float32", | ||
], | ||
) | ||
def test_groupby_agg_precision(dtype): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you use the any_real_numeric_dtype
fixture here?
"key1": ["a"], | ||
"key2": ["b"], | ||
"key3": [ | ||
pd.array([1583715738627261039], dtype=dtype)[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you specify a max_value
variable above this df
assignment and then write this as
df = pd.DataFrame({..., "key3": pd.array([max_value], dtype=dtype)})
} | ||
) | ||
expected = df[["key3"]] | ||
result = df.groupby(["key1", "key2"]).agg(lambda x: x).reset_index()[["key3"]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you construct expected
such that result
is just df.groupby(["key1", "key2"]).agg(lambda x: x)
?
66bd297
to
68f8fb2
Compare
Signed-off-by: Liang Yan <ckgppl_yan@sina.cn>
68f8fb2
to
5f7327f
Compare
Thanks @liang3zy22 |
This a new PR to fix #33234 since old PR closed.