Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: Add DataFrame/Series.align #1668

Merged
merged 1 commit into from
Oct 18, 2016
Merged

ENH: Add DataFrame/Series.align #1668

merged 1 commit into from
Oct 18, 2016

Conversation

sinhrks
Copy link
Member

@sinhrks sinhrks commented Oct 16, 2016

df1 = pd.DataFrame({'A': np.random.randn(5), 
                   'B': np.random.randn(5)},
                  index=list('ABCDE'))
ddf1 = dd.from_pandas(df1, 2)

df2 = pd.DataFrame({'A': np.random.randn(5), 
                   'B': np.random.randn(5)},
                  index=list('BDEFG'))
ddf2 = dd.from_pandas(df2, 2)

res1, res2 = ddf1.align(ddf2)
res1.compute()
#            A         B
# A  -0.693455  1.729368
# B   1.486508 -0.489367
# ..       ...       ...
# F        NaN       NaN
# G        NaN       NaN
# 
# [7 rows x 2 columns]

res2.compute()
#            A         B
# A        NaN       NaN
# B   0.191631  0.023919
# ..       ...       ...
# F   0.010644 -0.366820
# G  -0.651027 -0.126170
# 
# [7 rows x 2 columns]

@mrocklin
Copy link
Member

I don't have any experience with pandas.align, so I'm not sure that I'm a good judge here, but the test suite and implementation here seems good to me. +1

@jreback
Copy link
Contributor

jreback commented Oct 16, 2016

align is used all over the place internally in pandas esp for join/merge

not sure if that impacts

@mrocklin
Copy link
Member

This has merge conflicts from recently merged PRs.

@mrocklin mrocklin merged commit f844385 into dask:master Oct 18, 2016
@sinhrks sinhrks deleted the align branch October 18, 2016 12:11
@sinhrks sinhrks added this to the 0.12.0 milestone Nov 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants