-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: align with broadcast_axis, #13194 #13198
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
Changes from 4 commits
b4867df
a4e6804
51c5968
e15e17e
e6ec1d9
1b5bbde
fb1b41f
248e8da
6de9b0c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1874,6 +1874,52 @@ def test_pipe_panel(self): | |
with tm.assertRaises(ValueError): | ||
result = wp.pipe((f, 'y'), x=1, y=1) | ||
|
||
def test_align_joins(self): | ||
df = DataFrame(np.array([[1., 2.], [3., 4.]]), columns=list('AB')) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add the issue number as a comment here rename to |
||
ts = Series([5., 6., 7.]) | ||
check = df.align(ts, join='outer', axis=0, broadcast_axis=1) | ||
df1 = DataFrame(check[0]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. all of these tests need to go in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. model them after the existing tests. |
||
df2 = DataFrame(check[1]) | ||
expected1 = DataFrame(np.array([[1., 2.], [3., 4.], | ||
[pd.np.nan, pd.np.nan]]), | ||
columns=list('AB')) | ||
expected2 = DataFrame(np.array([[5., 5.], [6., 6.], [7., 7.]]), | ||
columns=list('AB')) | ||
assert_frame_equal(df1, expected1) | ||
assert_frame_equal(df2, expected2) | ||
|
||
check = df.align(ts, join='inner', axis=0, broadcast_axis=1) | ||
df1 = DataFrame(check[0]) | ||
df2 = DataFrame(check[1]) | ||
expected1 = DataFrame(np.array([[1., 2.], [3., 4.]]), | ||
columns=list('AB')) | ||
expected2 = DataFrame(np.array([[5., 5.], [6., 6.]]), | ||
columns=list('AB')) | ||
assert_frame_equal(df1, expected1) | ||
assert_frame_equal(df2, expected2) | ||
|
||
check = df.align(ts, join='left', axis=0, broadcast_axis=1) | ||
df1 = DataFrame(check[0]) | ||
df2 = DataFrame(check[1]) | ||
expected1 = DataFrame(np.array([[1., 2.], [3., 4.]]), | ||
columns=list('AB')) | ||
expected2 = DataFrame(np.array([[5., 5.], [6., 6.]]), | ||
columns=list('AB')) | ||
assert_frame_equal(df1, expected1) | ||
assert_frame_equal(df2, expected2) | ||
|
||
check = df.align(ts, join='right', axis=0, broadcast_axis=1) | ||
df1 = DataFrame(check[0]) | ||
df2 = DataFrame(check[1]) | ||
expected1 = DataFrame(np.array([[1., 2.], [3., 4.], | ||
[pd.np.nan, pd.np.nan]]), | ||
columns=list('AB')) | ||
expected2 = DataFrame(np.array([[5., 5.], [6., 6.], [7., 7.]]), | ||
columns=list('AB')) | ||
assert_frame_equal(df1, expected1) | ||
assert_frame_equal(df2, expected2) | ||
|
||
|
||
if __name__ == '__main__': | ||
nose.runmodule(argv=[__file__, '-vvs', '-x', '--pdb', '--pdb-failure'], | ||
exit=False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
be more descriptive of what you fixed here. remember a user is reading this.