8000 add some column tests for the protocol · iskode/dataframe-api@bfe6432 · GitHub
[go: up one dir, main page]

Skip to content

Commit bfe6432

Browse files
committed
add some column tests for the protocol
1 parent f7b42e1 commit bfe6432

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

protocol/pandas_implementation.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -538,13 +538,18 @@ def get_chunks(self, n_chunks : Optional[int] = None) -> Iterable['_PandasDataFr
538538
# Roundtrip testing
539539
# -----------------
540540

541+
def test_column(pdcol:pd.Series, col: _PandasColumn):
542+
assert pdcol.size == col.size
543+
assert col.offset == 0
544+
assert pdcol.isnull().sum() == col.null_count
545+
541546
def test__dataframe__(df:pd.DataFrame, dfo: DataFrameObject):
542547
assert dfo.num_columns() == len(df.columns)
543548
assert dfo.num_rows() == len(df)
544549
assert dfo.num_chunks() == 1
545550
assert dfo.column_names() == list(df.columns)
546-
547-
551+
for col in df.columns:
552+
test_column(df[col], dfo.get_column_by_name(col))
548553

549554
def test_float_only():
550555
df = pd.DataFrame(data=dict(a=[1.5, 2.5, 3.5], b=[9.2, 10.5, 11.8]))

0 commit comments

Comments
 (0)
0