-
-
Notifications
You must be signed in to change notification settings - Fork 18k
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
Support non unique period indexes on join and merge operations #16949
Changes from 1 commit
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 |
---|---|---|
|
@@ -550,6 +550,13 @@ def test_join_mixed_non_unique_index(self): | |
index=[1, 2, 2, 'a']) | ||
tm.assert_frame_equal(result, expected) | ||
|
||
def test_join_non_unique_period_index(self): | ||
per_index = pd.period_range('2016-01-01', periods=16, freq='M') | ||
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. call this index |
||
per_df = DataFrame([i for i in range(len(per_index))], | ||
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. call this df |
||
index=per_index, columns=['pnum']) | ||
df2 = concat([per_df, per_df]) | ||
per_df.join(df2, how='outer', rsuffix='_df2') | ||
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. result = and provide an expected result; compare using |
||
|
||
def test_mixed_type_join_with_suffix(self): | ||
# GH #916 | ||
df = DataFrame(np.random.randn(20, 6), | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -585,6 +585,13 @@ def test_merge_on_datetime64tz(self): | |
assert result['value_x'].dtype == 'datetime64[ns, US/Eastern]' | ||
assert result['value_y'].dtype == 'datetime64[ns, US/Eastern]' | ||
|
||
def test_merge_non_unique_period_index(self): | ||
per_index = pd.period_range('2016-01-01', periods=16, freq='M') | ||
per_df = DataFrame([i for i in range(len(per_index))], | ||
index=per_index, columns=['pnum']) | ||
df2 = concat([per_df, per_df]) | ||
per_df.merge(df2, left_index=True, right_index=True, how='outer') | ||
|
||
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. same here |
||
def test_merge_on_periods(self): | ||
left = pd.DataFrame({'key': pd.period_range('20151010', periods=2, | ||
freq='D'), | ||
|
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.
add the issue number here as a comment