Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,6 @@ def pdf(self):
}
)

@property
def psdf(self):
return ps.from_pandas(self.pdf)

@property
def pser(self):
return pd.Series([1, 2, 3], dtype="category")
Expand Down
8 changes: 2 additions & 6 deletions python/pyspark/pandas/tests/indexes/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,17 @@
MissingPandasLikeMultiIndex,
MissingPandasLikeTimedeltaIndex,
)
from pyspark.testing.pandasutils import PandasOnSparkTestCase, TestUtils, SPARK_CONF_ARROW_ENABLED
from pyspark.testing.pandasutils import ComparisonTestBase, TestUtils, SPARK_CONF_ARROW_ENABLED


class IndexesTest(PandasOnSparkTestCase, TestUtils):
class IndexesTest(ComparisonTestBase, TestUtils):
@property
def pdf(self):
return pd.DataFrame(
{"a": [1, 2, 3, 4, 5, 6, 7, 8, 9], "b": [4, 5, 6, 3, 2, 1, 0, 0, 0]},
index=[0, 1, 3, 5, 6, 8, 9, 9, 9],
)

@property
def psdf(self):
return ps.from_pandas(self.pdf)

def test_index_basic(self):
for pdf in [
pd.DataFrame(np.random.randn(10, 5), index=np.random.randint(100, size=10)),
Expand Down
8 changes: 2 additions & 6 deletions python/pyspark/pandas/tests/test_categorical.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
from pandas.api.types import CategoricalDtype

import pyspark.pandas as ps
from pyspark.testing.pandasutils import PandasOnSparkTestCase, TestUtils
from pyspark.testing.pandasutils import ComparisonTestBase, TestUtils


class CategoricalTest(PandasOnSparkTestCase, TestUtils):
class CategoricalTest(ComparisonTestBase, TestUtils):
@property
def pdf(self):
return pd.DataFrame(
Expand All @@ -38,10 +38,6 @@ def pdf(self):
},
)

@property
def psdf(self):
return ps.from_pandas(self.pdf)

@property
def df_pair(self):
return self.pdf, self.psdf
Expand Down
8 changes: 2 additions & 6 deletions python/pyspark/pandas/tests/test_dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,26 +43,22 @@
)
from pyspark.testing.pandasutils import (
have_tabulate,
PandasOnSparkTestCase,
ComparisonTestBase,
SPARK_CONF_ARROW_ENABLED,
tabulate_requirement_message,
)
from pyspark.testing.sqlutils import SQLTestUtils
from pyspark.pandas.utils import name_like_string


class DataFrameTest(PandasOnSparkTestCase, SQLTestUtils):
class DataFrameTest(ComparisonTestBase, SQLTestUtils):
@property
def pdf(self):
return pd.DataFrame(
{"a": [1, 2, 3, 4, 5, 6, 7, 8, 9], "b": [4, 5, 6, 3, 2, 1, 0, 0, 0]},
index=np.random.rand(9),
)

@property
def psdf(self):
return ps.from_pandas(self.pdf)

@property
def df_pair(self):
pdf = self.pdf
Expand Down
8 changes: 2 additions & 6 deletions python/pyspark/pandas/tests/test_dataframe_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@
import pandas as pd

from pyspark import pandas as ps
from pyspark.testing.pandasutils import PandasOnSparkTestCase, TestUtils
from pyspark.testing.pandasutils import ComparisonTestBase, TestUtils
from pyspark.testing.sqlutils import SQLTestUtils


class DataFrameConversionTest(PandasOnSparkTestCase, SQLTestUtils, TestUtils):
class DataFrameConversionTest(ComparisonTestBase, SQLTestUtils, TestUtils):
"""Test cases for "small data" conversion and I/O."""

def setUp(self):
Expand All @@ -42,10 +42,6 @@ def tearDown(self):
def pdf(self):
return pd.DataFrame({"a": [1, 2, 3], "b": [4, 5, 6]}, index=[0, 1, 3])

@property
def psdf(self):
return ps.from_pandas(self.pdf)

@staticmethod
def strip_all_whitespace(str):
"""A helper function to remove all whitespace from a string."""
Expand Down
8 changes: 2 additions & 6 deletions python/pyspark/pandas/tests/test_extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import pandas as pd

from pyspark import pandas as ps
from pyspark.testing.pandasutils import assert_produces_warning, PandasOnSparkTestCase
from pyspark.testing.pandasutils import assert_produces_warning, ComparisonTestBase
from pyspark.pandas.extensions import (
register_dataframe_accessor,
register_series_accessor,
Expand Down Expand Up @@ -66,18 +66,14 @@ def check_length(self, col=None):
raise ValueError(str(e))


class ExtensionTest(PandasOnSparkTestCase):
class ExtensionTest(ComparisonTestBase):
@property
def pdf(self):
return pd.DataFrame(
{"a": [1, 2, 3, 4, 5, 6, 7, 8, 9], "b": [4, 5, 6, 3, 2, 1, 0, 0, 0]},
index=np.random.rand(9),
)

@property
def psdf(self):
return ps.from_pandas(self.pdf)

@property
def accessor(self):
return CustomAccessor(self.psdf)
Expand Down
8 changes: 2 additions & 6 deletions python/pyspark/pandas/tests/test_indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

from pyspark import pandas as ps
from pyspark.pandas.exceptions import SparkPandasIndexingError
from pyspark.testing.pandasutils import ComparisonTestBase, PandasOnSparkTestCase, compare_both
from pyspark.testing.pandasutils import ComparisonTestBase, compare_both


class BasicIndexingTest(ComparisonTestBase):
Expand Down Expand Up @@ -153,18 +153,14 @@ def test_limitations(self):
)


class IndexingTest(PandasOnSparkTestCase):
class IndexingTest(ComparisonTestBase):
@property
def pdf(self):
return pd.DataFrame(
{"a": [1, 2, 3, 4, 5, 6, 7, 8, 9], "b": [4, 5, 6, 3, 2, 1, 0, 0, 0]},
index=[0, 1, 3, 5, 6, 8, 9, 9, 9],
)

@property
def psdf(self):
return ps.from_pandas(self.pdf)

@property
def pdf2(self):
return pd.DataFrame(
Expand Down
8 changes: 2 additions & 6 deletions python/pyspark/pandas/tests/test_numpy_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
from pyspark import pandas as ps
from pyspark.pandas import set_option, reset_option
from pyspark.pandas.numpy_compat import unary_np_spark_mappings, binary_np_spark_mappings
from pyspark.testing.pandasutils import PandasOnSparkTestCase
from pyspark.testing.pandasutils import ComparisonTestBase
from pyspark.testing.sqlutils import SQLTestUtils


class NumPyCompatTest(PandasOnSparkTestCase, SQLTestUtils):
class NumPyCompatTest(ComparisonTestBase, SQLTestUtils):
blacklist = [
# Koalas does not currently support
"conj",
Expand Down Expand Up @@ -55,10 +55,6 @@ def pdf(self):
index=[0, 1, 3, 5, 6, 8, 9, 9, 9],
)

@property
def psdf(self):
return ps.from_pandas(self.pdf)

def test_np_add_series(self):
psdf = self.psdf
pdf = self.pdf
Expand Down