diff --git a/pandas/core/interchange/column.py b/pandas/core/interchange/column.py index 83f57d5bb8d3e..bb78bb7d38afb 100644 --- a/pandas/core/interchange/column.py +++ b/pandas/core/interchange/column.py @@ -81,7 +81,6 @@ def __init__(self, column: pd.Series, allow_copy: bool = True) -> None: self._col = column self._allow_copy = allow_copy - @property def size(self) -> int: """ Size of the column, in elements. diff --git a/pandas/tests/interchange/test_impl.py b/pandas/tests/interchange/test_impl.py index b4c27ba31317b..328050d0c0cb8 100644 --- a/pandas/tests/interchange/test_impl.py +++ b/pandas/tests/interchange/test_impl.py @@ -163,14 +163,14 @@ def test_string(): df = pd.DataFrame({"A": test_str_data}) col = df.__dataframe__().get_column_by_name("A") - assert col.size == 6 + assert col.size() == 6 assert col.null_count == 1 assert col.dtype[0] == DtypeKind.STRING assert col.describe_null == (ColumnNullType.USE_BYTEMASK, 0) df_sliced = df[1:] col = df_sliced.__dataframe__().get_column_by_name("A") - assert col.size == 5 + assert col.size() == 5 assert col.null_count == 1 assert col.dtype[0] == DtypeKind.STRING assert col.describe_null == (ColumnNullType.USE_BYTEMASK, 0) @@ -187,7 +187,7 @@ def test_datetime(): df = pd.DataFrame({"A": [pd.Timestamp("2022-01-01"), pd.NaT]}) col = df.__dataframe__().get_column_by_name("A") - assert col.size == 2 + assert col.size() == 2 assert col.null_count == 1 assert col.dtype[0] == DtypeKind.DATETIME assert col.describe_null == (ColumnNullType.USE_SENTINEL, iNaT) diff --git a/pandas/tests/interchange/test_spec_conformance.py b/pandas/tests/interchange/test_spec_conformance.py index 392402871a5fd..965938b111e86 100644 --- a/pandas/tests/interchange/test_spec_conformance.py +++ b/pandas/tests/interchange/test_spec_conformance.py @@ -27,7 +27,7 @@ def test_only_one_dtype(test_data, df_from_dict): null_count = dfX.get_column_by_name(column).null_count assert null_count == 0 assert isinstance(null_count, int) - assert dfX.get_column_by_name(column).size == column_size + assert dfX.get_column_by_name(column).size() == column_size assert dfX.get_column_by_name(column).offset == 0 @@ -52,7 +52,7 @@ def test_mixed_dtypes(df_from_dict): colX = dfX.get_column_by_name(column) assert colX.null_count == 0 assert isinstance(colX.null_count, int) - assert colX.size == 3 + assert colX.size() == 3 assert colX.offset == 0 assert colX.dtype[0] == kind @@ -118,14 +118,14 @@ def test_column_get_chunks(size, n_chunks, df_from_dict): dfX = df.__dataframe__() chunks = list(dfX.get_column(0).get_chunks(n_chunks)) assert len(chunks) == n_chunks - assert sum(chunk.size for chunk in chunks) == size + assert sum(chunk.size() for chunk in chunks) == size def test_get_columns(df_from_dict): df = df_from_dict({"a": [0, 1], "b": [2.5, 3.5]}) dfX = df.__dataframe__() for colX in dfX.get_columns(): - assert colX.size == 2 + assert colX.size() == 2 assert colX.num_chunks() == 1 # for meanings of dtype[0] see the spec; we cannot import the spec here as this # file is expected to be vendored *anywhere*