-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
ERR: raise if values passed to Categorical is a DataFrame #18207
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 all commits
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 |
---|---|---|
|
@@ -173,6 +173,12 @@ def test_constructor_unsortable(self): | |
pytest.raises( | ||
TypeError, lambda: Categorical(arr, ordered=True)) | ||
|
||
def test_constructor_dataframe_error(self): | ||
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. paramatrize with a ndarray > 1 dim |
||
# GH#17112 | ||
df = pd.DataFrame(np.random.randn(3, 2), columns=['A', 'B']) | ||
with pytest.raises(NotImplementedError): | ||
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. This is where checking the error message is helpful. AFAICT, your tests don't cover both places where a 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. agree here 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. Good idea, will do. |
||
Categorical(df) | ||
|
||
def test_constructor_interval(self): | ||
result = Categorical([Interval(1, 2), Interval(2, 3), Interval(3, 6)], | ||
ordered=True) | ||
|
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.
this doesn't get hit in the tests