From c076f4d44886c75756428101bb2d70413327a090 Mon Sep 17 00:00:00 2001 From: Anatoly Myachev Date: Sun, 10 Sep 2023 00:31:55 +0200 Subject: [PATCH] TEST-#4477: add tests for 'df.eval' with scalar and groupby.transofm call in the expr Signed-off-by: Anatoly Myachev --- modin/pandas/test/dataframe/test_udf.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/modin/pandas/test/dataframe/test_udf.py b/modin/pandas/test/dataframe/test_udf.py index 419ba963d2b..652ea263c3f 100644 --- a/modin/pandas/test/dataframe/test_udf.py +++ b/modin/pandas/test/dataframe/test_udf.py @@ -338,6 +338,18 @@ def test_eval_df_arithmetic_subexpression(): df_equals(modin_df, df) +def test_eval_groupby_transform(): + # see #5511 for details + df = pd.DataFrame({"num": range(1, 1001), "group": ["A"] * 500 + ["B"] * 500}) + assert df.eval("num.groupby(group).transform('min')").unique().tolist() == [1, 501] + + +def test_eval_scalar(): + # see #4477 for details + df = pd.DataFrame([[2]]) + assert df.eval("1") == 1 + + TEST_VAR = 2