Skip to content

Commit

Permalink
First try to test Modin with pandas implementation of dataframe api p…
Browse files Browse the repository at this point in the history
…rotocol

Signed-off-by: Anatoly Myachev <[email protected]>
  • Loading branch information
anmyachev committed Dec 4, 2023
1 parent e4035eb commit 812be52
Show file tree
Hide file tree
Showing 73 changed files with 119 additions and 79 deletions.
2 changes: 1 addition & 1 deletion dataframe_api_compat/pandas_standard/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from typing import Literal
from typing import cast

import pandas as pd
import modin.pandas as pd

from dataframe_api_compat.pandas_standard.column_object import Column
from dataframe_api_compat.pandas_standard.dataframe_object import DataFrame
Expand Down
2 changes: 1 addition & 1 deletion dataframe_api_compat/pandas_standard/column_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from typing import NoReturn

import numpy as np
import pandas as pd
import modin.pandas as pd
from pandas.api.types import is_extension_array_dtype

import dataframe_api_compat.pandas_standard
Expand Down
2 changes: 1 addition & 1 deletion dataframe_api_compat/pandas_standard/dataframe_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from typing import NoReturn

import numpy as np
import pandas as pd
import modin.pandas as pd
from pandas.api.types import is_extension_array_dtype

import dataframe_api_compat
Expand Down
2 changes: 1 addition & 1 deletion dataframe_api_compat/pandas_standard/group_by_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from typing import TYPE_CHECKING
from typing import cast

import pandas as pd
import modin.pandas as pd

from dataframe_api_compat.pandas_standard import Namespace
from dataframe_api_compat.pandas_standard.dataframe_object import DataFrame
Expand Down
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ force-single-line = true
filterwarnings = [
"error",
'ignore:distutils Version classes are deprecated:DeprecationWarning',
'ignore:.*pkg_resources:DeprecationWarning',
'ignore:Ray execution environment not yet initialized:UserWarning',
"ignore:Distributing <class '.*'> object.:UserWarning",
'ignore:.*ray:ResourceWarning',
'ignore:.*is not currently supported by PandasOnRay:UserWarning',
'ignore:.*implementation has mismatches with pandas:UserWarning',
]
xfail_strict = true

Expand Down
2 changes: 1 addition & 1 deletion tests/column/and_or_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

import pandas as pd
import modin.pandas as pd

from tests.utils import bool_dataframe_1
from tests.utils import interchange_to_pandas
Expand Down
2 changes: 1 addition & 1 deletion tests/column/col_sorted_indices_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

import pandas as pd
import modin.pandas as pd

from tests.utils import convert_dataframe_to_pandas_numpy
from tests.utils import integer_dataframe_6
Expand Down
2 changes: 1 addition & 1 deletion tests/column/comparisons_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from typing import Any

import pandas as pd
import modin.pandas as pd
import pytest

from tests.utils import integer_dataframe_1
Expand Down
15 changes: 15 additions & 0 deletions tests/column/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

import modin.pandas as pd

class NameSpaceCustom:
def assert_series_equal(df1, df2, check_exact=False):
from modin.pandas.test.utils import df_equals
df_equals(df1, df2, check_exact=check_exact)

def assert_frame_equal(df1, df2):
from modin.pandas.test.utils import df_equals
df_equals(df1, df2)

pd.testing = NameSpaceCustom

pd.__version__ = "0.25.0"
2 changes: 1 addition & 1 deletion tests/column/cumulative_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

import pandas as pd
import modin.pandas as pd
import pytest

from tests.utils import integer_dataframe_1
Expand Down
2 changes: 1 addition & 1 deletion tests/column/divmod_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

import pandas as pd
import modin.pandas as pd

from tests.utils import integer_dataframe_1
from tests.utils import interchange_to_pandas
Expand Down
2 changes: 1 addition & 1 deletion tests/column/fill_nan_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

import pandas as pd
import modin.pandas as pd

from tests.utils import interchange_to_pandas
from tests.utils import nan_dataframe_1
Expand Down
2 changes: 1 addition & 1 deletion tests/column/get_rows_by_mask_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

import pandas as pd
import modin.pandas as pd

from tests.utils import integer_dataframe_1
from tests.utils import interchange_to_pandas
Expand Down
2 changes: 1 addition & 1 deletion tests/column/get_rows_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

import pandas as pd
import modin.pandas as pd

from tests.utils import integer_dataframe_1
from tests.utils import interchange_to_pandas
Expand Down
2 changes: 1 addition & 1 deletion tests/column/invalid_pandas_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

import pandas as pd
import modin.pandas as pd
import pytest

from dataframe_api_compat.pandas_standard import convert_to_standard_compliant_dataframe
Expand Down
2 changes: 1 addition & 1 deletion tests/column/invert_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

import pandas as pd
import modin.pandas as pd

from tests.utils import bool_dataframe_1
from tests.utils import interchange_to_pandas
Expand Down
2 changes: 1 addition & 1 deletion tests/column/is_in_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from typing import TYPE_CHECKING
from typing import Any

import pandas as pd
import modin.pandas as pd
import pytest

from tests.utils import float_dataframe_1
Expand Down
2 changes: 1 addition & 1 deletion tests/column/is_nan_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

import pandas as pd
import modin.pandas as pd

from tests.utils import interchange_to_pandas
from tests.utils import nan_dataframe_1
Expand Down
2 changes: 1 addition & 1 deletion tests/column/is_null_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

import pandas as pd
import modin.pandas as pd

from tests.utils import interchange_to_pandas
from tests.utils import nan_dataframe_1
Expand Down
16 changes: 8 additions & 8 deletions tests/column/name_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

import pandas as pd
import modin.pandas as pd
import pytest

from tests.utils import integer_dataframe_1
Expand All @@ -12,10 +12,10 @@ def test_name(library: str) -> None:
assert name == "a"


@pytest.mark.skipif(
tuple(int(v) for v in pd.__version__.split(".")) < (2, 1, 0),
reason="before consoritum standard",
)
def test_invalid_name_pandas() -> None:
with pytest.raises(ValueError):
pd.Series([1, 2, 3], name=0).__column_consortium_standard__()
#@pytest.mark.skipif(
# tuple(int(v) for v in pd.__version__.split(".")) < (2, 1, 0),
# reason="before consoritum standard",
#)
#def test_invalid_name_pandas() -> None:
# with pytest.raises(ValueError):
# pd.Series([1, 2, 3], name=0).__column_consortium_standard__()
2 changes: 1 addition & 1 deletion tests/column/pow_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

import pandas as pd
import modin.pandas as pd

from tests.utils import convert_dataframe_to_pandas_numpy
from tests.utils import integer_dataframe_1
Expand Down
2 changes: 1 addition & 1 deletion tests/column/reductions_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

import pandas as pd
import modin.pandas as pd
import pytest

from tests.utils import integer_dataframe_1
Expand Down
2 changes: 1 addition & 1 deletion tests/column/shift_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import pandas as pd
import modin.pandas as pd
import polars as pl
from polars.testing import assert_frame_equal

Expand Down
2 changes: 1 addition & 1 deletion tests/column/slice_rows_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from typing import Any

import pandas as pd
import modin.pandas as pd
import pytest

from tests.utils import integer_dataframe_3
Expand Down
2 changes: 1 addition & 1 deletion tests/column/sort_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

import pandas as pd
import modin.pandas as pd

from tests.utils import convert_dataframe_to_pandas_numpy
from tests.utils import integer_dataframe_6
Expand Down
2 changes: 1 addition & 1 deletion tests/column/statistics_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

import pandas as pd
import modin.pandas as pd

from tests.utils import integer_dataframe_1
from tests.utils import interchange_to_pandas
Expand Down
2 changes: 1 addition & 1 deletion tests/column/temporal/components_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from typing import Literal

import pandas as pd
import modin.pandas as pd
import pytest

from tests.utils import interchange_to_pandas
Expand Down
2 changes: 1 addition & 1 deletion tests/column/temporal/filter_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import pandas as pd
import modin.pandas as pd

from tests.utils import interchange_to_pandas
from tests.utils import temporal_dataframe_1
Expand Down
2 changes: 1 addition & 1 deletion tests/column/temporal/floor_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from datetime import datetime

import pandas as pd
import modin.pandas as pd
import pytest

from tests.utils import interchange_to_pandas
Expand Down
18 changes: 17 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

LIBRARIES = {
(3, 8): ["pandas-numpy", "pandas-nullable", "polars-lazy"],
(3, 9): ["pandas-numpy", "pandas-nullable", "polars-lazy"],
(3, 9): ["pandas-nullable", "pandas-numpy"],
(3, 10): ["pandas-numpy", "pandas-nullable", "polars-lazy"],
(3, 11): ["pandas-numpy", "pandas-nullable", "polars-lazy"],
(3, 12): ["polars-lazy"],
Expand All @@ -18,3 +18,19 @@ def pytest_generate_tests(metafunc: Any) -> None:
"library",
LIBRARIES[sys.version_info[:2]],
)


import modin.pandas as pd

class NameSpaceCustom:
def assert_series_equal(df1, df2, check_exact=False):
from modin.pandas.test.utils import df_equals
df_equals(df1, df2, check_exact=check_exact)

def assert_frame_equal(df1, df2):
from modin.pandas.test.utils import df_equals
df_equals(df1, df2)

pd.testing = NameSpaceCustom

pd.__version__ = "0.25.0"
2 changes: 1 addition & 1 deletion tests/dataframe/all_rowwise_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

import pandas as pd
import modin.pandas as pd
import pytest

from tests.utils import bool_dataframe_1
Expand Down
2 changes: 1 addition & 1 deletion tests/dataframe/and_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

import pandas as pd
import modin.pandas as pd

from tests.utils import bool_dataframe_1
from tests.utils import convert_dataframe_to_pandas_numpy
Expand Down
2 changes: 1 addition & 1 deletion tests/dataframe/any_all_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

import pandas as pd
import modin.pandas as pd
import pytest

from tests.utils import bool_dataframe_1
Expand Down
2 changes: 1 addition & 1 deletion tests/dataframe/any_rowwise_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

import pandas as pd
import modin.pandas as pd
import pytest

from tests.utils import bool_dataframe_1
Expand Down
2 changes: 1 addition & 1 deletion tests/dataframe/assign_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

import pandas as pd
import modin.pandas as pd
import pytest

from tests.utils import convert_dataframe_to_pandas_numpy
Expand Down
2 changes: 1 addition & 1 deletion tests/dataframe/columns_iter_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import pandas as pd
import modin.pandas as pd

from tests.utils import integer_dataframe_1
from tests.utils import interchange_to_pandas
Expand Down
2 changes: 1 addition & 1 deletion tests/dataframe/comparisons_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

import pandas as pd
import modin.pandas as pd
import pytest

from tests.utils import convert_dataframe_to_pandas_numpy
Expand Down
2 changes: 1 addition & 1 deletion tests/dataframe/divmod_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

import pandas as pd
import modin.pandas as pd

from tests.utils import convert_dataframe_to_pandas_numpy
from tests.utils import integer_dataframe_1
Expand Down
2 changes: 1 addition & 1 deletion tests/dataframe/drop_column_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

import pandas as pd
import modin.pandas as pd

from tests.utils import convert_dataframe_to_pandas_numpy
from tests.utils import integer_dataframe_1
Expand Down
2 changes: 1 addition & 1 deletion tests/dataframe/drop_nulls_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import pandas as pd
import modin.pandas as pd

from tests.utils import interchange_to_pandas
from tests.utils import null_dataframe_1
Expand Down
2 changes: 1 addition & 1 deletion tests/dataframe/fill_nan_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

import pandas as pd
import modin.pandas as pd
import pytest

from tests.utils import interchange_to_pandas
Expand Down
2 changes: 1 addition & 1 deletion tests/dataframe/get_column_by_name_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

import pandas as pd
import modin.pandas as pd

from tests.utils import convert_dataframe_to_pandas_numpy
from tests.utils import integer_dataframe_1
Expand Down
2 changes: 1 addition & 1 deletion tests/dataframe/get_rows_by_mask_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

import pandas as pd
import modin.pandas as pd

from tests.utils import convert_dataframe_to_pandas_numpy
from tests.utils import integer_dataframe_1
Expand Down
Loading

0 comments on commit 812be52

Please sign in to comment.