Repository navigation
Closed
Milestone
Description
Dask's dd.merge operation returns incorrect results under certain unkown condition. Seems to be related to the size of the dataframe.
I have created a repo for this issue.
https://gitlab.com/LouisTian/dask_merge_issue
import dask.dataframe as dd
import pandas as pddask_df = dd.read_csv('./fastText_extract.csv', encoding='utf-8', usecols=list(range(1, 302)))
pd_df = pd.read_csv('./fastText_extract.csv', encoding='utf-8', usecols=list(range(1, 302)))
features = pd.read_csv('./features.csv', encoding='utf-8', usecols=[1])pd_df[pd_df['word'] == 'leonid']| word | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | ... | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 15810 | leonid | -0.11284 | 0.27493 | -0.11428 | 0.27465 | -0.1484 | -0.16222 | 0.54122 | -0.35387 | -0.44765 | ... | -0.35554 | -0.21266 | 0.048219 | -0.023976 | 0.23689 | -0.11721 | 0.012078 | -0.15143 | -0.19005 | 0.043254 |
1 rows × 301 columns
features[features['word'] == 'leonid']| word | |
|---|---|
| 614 | leonid |
Different merge result using pandas and dask
result = pd_df.merge(features, on='word', how='right')
result[result['word'] == 'leonid']| word | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | ... | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 15810 | leonid | -0.11284 | 0.27493 | -0.11428 | 0.27465 | -0.1484 | -0.16222 | 0.54122 | -0.35387 | -0.44765 | ... | -0.35554 | -0.21266 | 0.048219 | -0.023976 | 0.23689 | -0.11721 | 0.012078 | -0.15143 | -0.19005 | 0.043254 |
1 rows × 301 columns
result = dask_df.merge(features, on='word', how='right').compute()
result[result['word'] == 'leonid']| word | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | ... | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 9748 | leonid | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
1 rows × 301 columns
Use smaller subset of data, same result
dask_df = dd.read_csv('./fastText_sample.csv', encoding='utf-8', usecols=list(range(1, 302)))
pd_df = pd.read_csv('./fastText_sample.csv', encoding='utf-8', usecols=list(range(1, 302)))
features = pd.read_csv('./features.csv', encoding='utf-8', usecols=[1])result = pd_df.merge(features, on='word', how='right')
result[result['word'] == 'leonid']| word | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | ... | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 810 | leonid | -0.11284 | 0.27493 | -0.11428 | 0.27465 | -0.1484 | -0.16222 | 0.54122 | -0.35387 | -0.44765 | ... | -0.35554 | -0.21266 | 0.048219 | -0.023976 | 0.23689 | -0.11721 | 0.012078 | -0.15143 | -0.19005 | 0.043254 |
1 rows × 301 columns
result = dask_df.merge(features, on='word', how='right').compute()
result[result['word'] == 'leonid']| word | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | ... | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 810 | leonid | -0.11284 | 0.27493 | -0.11428 | 0.27465 | -0.1484 | -0.16222 | 0.54122 | -0.35387 | -0.44765 | ... | -0.35554 | -0.21266 | 0.048219 | -0.023976 | 0.23689 | -0.11721 | 0.012078 | -0.15143 | -0.19005 | 0.043254 |
1 rows × 301 columns
Metadata
Metadata
Assignees
Labels
No labels
Activity
jcrist commentedon Apr 19, 2017
What version of dask are you using? I looked at that repo (and this one: https://github.com/Louis-Tian/dask_merge_issue) and didn't see the data. If you can provide a reproducible example and versions used (dask, pandas, partd, and numpy) that would help in debugging.
Louis-Tian commentedon Apr 19, 2017
@jcrist my apology. didn't make the repo public. Data are too big to be pushed to github, so please checkout the gitlab repo instead.
I am running
The requirements.txt in the repo has the complete environment.
Louis-Tian commentedon Apr 19, 2017
Run the same code on a Windows machine with python 2.7 and dask started throwing
UnicodeEncodeErrorwhile pandas still runs okay.1 rows × 301 columns
Different merge result using pandas and dask
1 rows × 301 columns
Use smaller subset of data, same result
1 rows × 301 columns
jcrist commentedon Apr 21, 2017
Thanks for the bug report, I've tracked this down to a bug in how we hash pandas object arrays (specifically object arrays that have missing values). Fix coming soon.
jcrist commentedon Apr 21, 2017
Fixed in #2243. Using your code, this now passes: