You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/10/06 15:05:19 UTC
[GitHub] [arrow] legout commented on issue #13747: [Python] group_by functionality directly on large dataset, instead of on a table?
legout commented on issue #13747:
URL: https://github.com/apache/arrow/issues/13747#issuecomment-1270226592
Hope this is not off-topic, but you can leverage `duckdb` or `polars` for this.
```python
import duckdb
import pyarrow.dataset as ds
import polars as pl
dset = ds.dataset('path/to/data')
# duckdb
con = duckdb.connect()
table = con.query("SELECTsum(col1), count(col1) FROM dset WHERE col1>10 GROUP BY col2").arrow()
#polars
table = pl.scan_ds(dset).filter(pl.col("col1")>10).groupby("col2").agg(
[pl.col("col1").sum(), pl.col("col1").count()]
).collect().to_arrow()
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org