We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent dd1701f commit 7391b73Copy full SHA for 7391b73
1 file changed
python/tests/test_dataframe.py
@@ -379,6 +379,23 @@ def test_cast(df):
379
assert df.schema() == expected
380
381
382
+def test_iter_batches(df):
383
+ batches = []
384
+ for batch in df:
385
+ batches.append(batch) # noqa: PERF402
386
+
387
+ # Delete DataFrame to ensure RecordBatches remain valid
388
+ del df
389
390
+ assert len(batches) == 1
391
392
+ batch = batches[0]
393
+ assert isinstance(batch, pa.RecordBatch)
394
+ assert batch.column(0).to_pylist() == [1, 2, 3]
395
+ assert batch.column(1).to_pylist() == [4, 5, 6]
396
+ assert batch.column(2).to_pylist() == [8, 5, 8]
397
398
399
def test_with_column_renamed(df):
400
df = df.with_column("c", column("a") + column("b")).with_column_renamed("c", "sum")
401
0 commit comments