-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
74ff08d
commit 0e511e5
Showing
6 changed files
with
74 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# | ||
# Copyright (c) 2012-2024 Snowflake Computing Inc. All rights reserved. | ||
# | ||
|
||
import modin.pandas as pd | ||
import pandas as native_pd | ||
import pytest | ||
|
||
import snowflake.snowpark.modin.plugin # noqa: F401 | ||
from tests.integ.modin.sql_counter import sql_count_checker | ||
|
||
|
||
@sql_count_checker(query_count=1) | ||
@pytest.mark.parametrize( | ||
"data, index", | ||
[ | ||
([1, None, 4, 3, 4], ["A", "B", "C", "D", "E"]), | ||
([4, None, 1, 3, 4, 1], ["A", "B", "C", "D", "E", "F"]), | ||
([4, None, 1, 3, 4, 1], [None, "B", "C", "D", "E", "F"]), | ||
([1, 10, 4, 3, 4], ["E", "D", "C", "A", "B"]), | ||
], | ||
) | ||
@pytest.mark.parametrize("func", ["argmax", "argmin"]) | ||
@pytest.mark.parametrize( | ||
"skipna", | ||
[True, False], | ||
) | ||
def test_argmax_argmin_series(data, index, func, skipna): | ||
native_series = native_pd.Series(data=data, index=index) | ||
snow_series = pd.Series(native_series) | ||
|
||
native_output = native_series.__getattribute__(func)(skipna=skipna) | ||
snow_output = snow_series.__getattribute__(func)(skipna=skipna) | ||
assert snow_output == native_output | ||
|
||
|
||
@pytest.mark.parametrize("func", ["argmax", "argmin"]) | ||
@pytest.mark.parametrize("skipna", [True, False]) | ||
@sql_count_checker(query_count=0) | ||
def test_series_argmax_argmin_with_multiindex_negative( | ||
multiindex_native_int_series, func, skipna | ||
): | ||
""" | ||
Test Series.argmax and Series.argmin with a MultiIndex Series. | ||
""" | ||
native_series = multiindex_native_int_series | ||
snow_series = pd.Series(native_series) | ||
with pytest.raises( | ||
NotImplementedError, | ||
match=f"Series.{func} is not yet supported when the index is a MultiIndex.", | ||
): | ||
snow_series.__getattribute__(func)(skipna=skipna) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters