-
Notifications
You must be signed in to change notification settings - Fork 653
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
TEST-#7049: Add some sanity tests with pyarrow-backed pandas dataframes #7199
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
8e46e4e
TEST-#7049: Add some sanity tests with pyarrow-backed pandas dataframes
anmyachev 6814c6e
fixes
anmyachev e1dbc69
fix
anmyachev 0241d7f
Merge branch 'main' of https://github.com/modin-project/modin into is…
anmyachev 7b925a5
cleanup
anmyachev 23003c5
fix comment
anmyachev cc2a5ab
skip some cases for HDK
anmyachev c3cc95a
Apply suggestions from code review
anmyachev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1387,6 +1387,70 @@ def test_constructor_arrow_extension_array(): | |
df_equals(md_ser.dtypes, pd_ser.dtypes) | ||
|
||
|
||
def test_pyarrow_backed_constructor(): | ||
pa = pytest.importorskip("pyarrow") | ||
data = list("abcd") | ||
df_equals(*create_test_series(data, dtype="string[pyarrow]")) | ||
df_equals(*create_test_series(data, dtype=pd.ArrowDtype(pa.string()))) | ||
|
||
data = [["hello"], ["there"]] | ||
list_str_type = pa.list_(pa.string()) | ||
df_equals(*create_test_series(data, dtype=pd.ArrowDtype(list_str_type))) | ||
|
||
|
||
def test_pyarrow_backed_functions(): | ||
pytest.importorskip("pyarrow") | ||
modin_series, pandas_series = create_test_series( | ||
[-1.545, 0.211, None], dtype="float32[pyarrow]" | ||
) | ||
df_equals(modin_series.mean(), pandas_series.mean()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. eval_general? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
def comparator(df1, df2): | ||
df_equals(df1, df2) | ||
df_equals(df1.dtypes, df2.dtypes) | ||
|
||
if StorageFormat.get() != "Hdk": | ||
# FIXME: HDK should also work in this case | ||
eval_general( | ||
modin_series, | ||
pandas_series, | ||
lambda ser: ser | ||
+ (modin_series if isinstance(ser, pd.Series) else pandas_series), | ||
comparator=comparator, | ||
) | ||
|
||
# FIXME: https://github.com/modin-project/modin/issues/7203 | ||
# eval_general( | ||
# modin_series, | ||
# pandas_series, | ||
# lambda ser: ser > (ser + 1), | ||
# comparator=comparator, | ||
# ) | ||
|
||
eval_general( | ||
modin_series, | ||
pandas_series, | ||
lambda ser: ser.dropna(), | ||
comparator=comparator, | ||
) | ||
|
||
eval_general( | ||
modin_series, | ||
pandas_series, | ||
lambda ser: ser.isna(), | ||
comparator=comparator, | ||
) | ||
|
||
if StorageFormat.get() != "Hdk": | ||
# FIXME: HDK should also work in this case | ||
eval_general( | ||
modin_series, | ||
pandas_series, | ||
lambda ser: ser.fillna(0), | ||
comparator=comparator, | ||
) | ||
|
||
|
||
def test_pyarrow_array_retrieve(): | ||
pa = pytest.importorskip("pyarrow") | ||
modin_series, pandas_series = create_test_series( | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
df_equals
function is used specifically since there is no benefit to usingeval_general
function (because the results of the constructors are tested).