@@ -23,6 +23,46 @@ def snow_df():
2323 )
2424
2525
26+ @sql_count_checker (query_count = 3 )
27+ def test_replace_SNOW_2390752_dataframe ():
28+ native_df = native_pd .DataFrame (
29+ {
30+ "col1" : ["one" , "two" , "two" , "three" , "two" , "four" ],
31+ "col2" : [
32+ "abc" ,
33+ "pqr" ,
34+ "xyz" ,
35+ None ,
36+ "pqr" ,
37+ "xyz" ,
38+ ],
39+ }
40+ )
41+ snow_df = pd .DataFrame (native_df )
42+ modin_df = snow_df .move_to ("Pandas" )
43+ assert modin_df .get_backend () == "Pandas"
44+
45+ eval_snowpark_pandas_result (
46+ snow_df , native_df , lambda df : df ["col1" ].replace (["two" ], ["a" ])
47+ )
48+ snow_result = snow_df ["col1" ].replace (["two" ], ["a" ])
49+ modin_result = modin_df ["col1" ].replace (["two" ], ["a" ])
50+ assert modin_result .to_pandas ().equals (snow_result .to_pandas ())
51+
52+
53+ @sql_count_checker (query_count = 3 , join_count = 2 )
54+ def test_replace_SNOW_2390752_series ():
55+ input_dict_native = native_pd .Series (
56+ {"a" : "apple" , "socks" : "socks are darned" , "b" : "bee" }
57+ )
58+ input_dict = pd .Series (input_dict_native )
59+ input_dict_pandas_modin = input_dict .move_to ("Pandas" )
60+ assert input_dict_pandas_modin .get_backend () == "Pandas"
61+ expected = input_dict_native ["socks" ].replace ("darned" , "clean" )
62+ assert input_dict ["socks" ].replace ("darned" , "clean" ) == expected
63+ assert input_dict_pandas_modin ["socks" ].replace ("darned" , "clean" ) == expected
64+
65+
2666@pytest .mark .parametrize (
2767 "to_replace, value" ,
2868 [
0 commit comments