-
-
Save elephantum/ed9975ac4e07b8bd59135e0bc8dc8ce8 to your computer and use it in GitHub Desktop.
Dask data loss with `.set_index`
This file contains hidden or 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
#VERSION=2020.12.0 | |
VERSION=2021.1.1 |
This file contains hidden or 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
version: '3' | |
services: | |
scheduler: | |
image: daskdev/dask:${VERSION} | |
command: dask-scheduler | |
volumes: | |
- ./test.py:/srv/test.py | |
wrk: | |
image: daskdev/dask:${VERSION} | |
command: dask-worker tcp://scheduler:8786 | |
deploy: | |
replicas: 2 |
This file contains hidden or 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
docker-compose up -d | |
docker-compose exec scheduler python /srv/test.py |
This file contains hidden or 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
(base) ➜ docker-compose exec scheduler python /srv/test.py | |
10000 | |
10000 | |
5015 |
This file contains hidden or 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
import uuid | |
import pandas as pd | |
import dask.dataframe as dd | |
from dask.distributed import Client | |
with Client('scheduler:8786') as client: | |
test_ddf = dd.from_pandas(pd.DataFrame({ | |
'uuid': [str(uuid.uuid4()) for i in range(10000)], | |
}), chunksize=100) | |
print(len(test_ddf)) | |
print(len(test_ddf.set_index('uuid'))) | |
print(len(test_ddf.set_index('uuid', shuffle='disk'))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment