Skip to content

BUG: Datetimelike equality comparisons with Categorical #38986

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 8 commits into from
Jan 8, 2021
Merged
Changes from all commits
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
14 changes: 14 additions & 0 deletions pandas/tests/arrays/test_datetimelike.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,20 @@ def test_compare_len1_raises(self):
with pytest.raises(ValueError, match="Lengths must match"):
idx <= idx[[0]]

@pytest.mark.parametrize(
"result",
[
pd.date_range("2020", periods=3),
pd.date_range("2020", periods=3, tz="UTC"),
pd.timedelta_range("0 days", periods=3),
pd.period_range("2020Q1", periods=3, freq="Q"),
],
)
def test_compare_with_Categorical(self, result):
expected = pd.Categorical(result)
assert all(result == expected)
assert not any(result != expected)

@pytest.mark.parametrize("reverse", [True, False])
@pytest.mark.parametrize("as_index", [True, False])
def test_compare_categorical_dtype(self, arr1d, as_index, reverse, ordered):
Expand Down