Skip to content

BUG: Interchange Column.size is a property, not a method #48392

Closed
@honno

Description

@honno
  • I have checked that this issue has not already been reported.
  • I have confirmed this bug exists on the latest version of pandas.
  • I have confirmed this bug exists on the main branch of pandas.

Reproducible Example

>>> df = pd.DataFrame({"foo": [42]})
>>> interchange_df = df.__dataframe__()
>>> interchange_col = interchange_df.get_column_by_name("foo")
>>> interchange_col.size()
TypeError: 'int' object is not callable

Issue Description

Per data-apis/dataframe-api#74, the interchange protocol now requires Column.size to be a method, not a property.

So the property decorator should be removed here, and usage of size-as-a-property in interchanging other libraries should be updated to size() (as well as in the test suite).

Couldn't see reference to this in the spec update PRs #47886 and #47887. Thanks to @maartenbreddels for catching this!

cc @mroeschke

Expected Behavior

>>> interchange_col.size()
1

Installed Versions

INSTALLED VERSIONS
------------------
commit           : 5a2b5afa0fa17fc5356625243315621e87e7f3af
python           : 3.8.12.final.0
python-bits      : 64
OS               : Linux
OS-release       : 5.15.0-47-generic
Version          : #51-Ubuntu SMP Thu Aug 11 07:51:15 UTC 2022
machine          : x86_64
processor        : x86_64
byteorder        : little
LC_ALL           : None
LANG             : en_GB.UTF-8
LOCALE           : en_GB.UTF-8

pandas           : 1.5.0.dev0+1223.g5a2b5afa0f
numpy            : 1.22.4
pytz             : 2022.1
dateutil         : 2.8.2
setuptools       : 62.6.0
pip              : 22.1.2
Cython           : None
pytest           : 7.2.0.dev227+gf43ddd8a
hypothesis       : 6.53.0
sphinx           : 4.2.0
blosc            : None
feather          : None
xlsxwriter       : None
lxml.etree       : None
html5lib         : None
pymysql          : None
psycopg2         : None
jinja2           : 3.1.2
IPython          : 8.4.0
pandas_datareader: None
bs4              : 4.11.1
bottleneck       : None
brotli           : None
fastparquet      : None
fsspec           : 2022.5.0
gcsfs            : 2022.5.0
matplotlib       : 3.5.2
numba            : 0.55.2
numexpr          : None
odfpy            : None
openpyxl         : None
pandas_gbq       : None
pyarrow          : 8.0.0
pyreadstat       : None
pyxlsb           : None
s3fs             : 2022.5.0
scipy            : 1.8.1
snappy           : None
sqlalchemy       : None
tables           : None
tabulate         : 0.8.10
xarray           : 2022.6.0
xlrd             : None
xlwt             : None
zstandard        : None

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions