-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d222d52
commit c2f1467
Showing
2 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# cuDF | ||
|
||
[cuDF](https://docs.rapids.ai/api/cudf/stable/) is a Python GPU DataFrame library. | ||
|
||
To read from a single Parquet file, use the [`read_parquet`](https://docs.rapids.ai/api/cudf/stable/user_guide/api_docs/api/cudf.read_parquet/) function to read it into a DataFrame: | ||
|
||
```py | ||
import cudf | ||
|
||
df = ( | ||
cudf.read_parquet("https://huggingface.co/datasets/blog_authorship_corpus/resolve/refs%2Fconvert%2Fparquet/blog_authorship_corpus/train/0000.parquet") | ||
.groupby('horoscope')['text'] | ||
.apply(lambda x: x.str.len().mean()) | ||
.sort_values(ascending=False) | ||
.head(5) | ||
) | ||
``` | ||
|
||
To read multiple Parquet files - for example, if the dataset is sharded - you'll need to use [`dask-cudf`](https://docs.rapids.ai/api/dask-cudf/stable/): | ||
|
||
```py | ||
import dask | ||
import dask.dataframe as dd | ||
|
||
dask.config.set({"dataframe.backend": "cudf"}) | ||
|
||
df = ( | ||
dd.read_parquet("https://huggingface.co/datasets/blog_authorship_corpus/resolve/refs%2Fconvert%2Fparquet/blog_authorship_corpus/train/*.parquet") | ||
) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters