Skip to content

BUG: Allow cast from cat to extension dtype #28762

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

Merged
merged 11 commits into from
Oct 8, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Clean up merge test
  • Loading branch information
Daniel Saxton committed Oct 6, 2019
commit 300e03700d2c07566c23785dba34d870adc9543d
15 changes: 6 additions & 9 deletions pandas/tests/reshape/merge/test_merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -2098,19 +2098,16 @@ def test_merge_equal_cat_dtypes2():

def test_merge_on_cat_and_ext_array():
# GH 28668
df1 = DataFrame(
right = DataFrame(
{"a": Series([pd.Interval(0, 1), pd.Interval(1, 2)], dtype="interval")}
)
df2 = df1.copy()
df2["a"] = df2["a"].astype("category")

joined1 = pd.merge(df1, df2, how="inner", on="a")
joined2 = pd.merge(df2, df1, how="inner", on="a")
left = right.copy()
left["a"] = left["a"].astype("category")

# dtype depends on order of join so this is necessary for now
joined2["a"] = joined2["a"].astype(joined1["a"].dtype)
result = pd.merge(left, right, how="inner", on="a")
expected = right.copy()

assert_frame_equal(joined1, joined2)
assert_frame_equal(result, expected)


def test_merge_multiindex_columns():
Expand Down