-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
Fix select_dtypes(include='int') for Windows. #36808
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
05406dc
4b75067
fb8cae9
49826cb
bd6e724
288efe9
39ef89b
f94722b
810bbab
9769b9d
f45f271
e8b523a
ac82794
a913bd8
502093b
9f26e18
06b7077
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 |
---|---|---|
|
@@ -110,7 +110,7 @@ def test_select_dtypes_exclude_include_using_list_like(self): | |
{ | ||
"a": list("abc"), | ||
"b": list(range(1, 4)), | ||
"c": np.arange(3, 6).astype("u1"), | ||
"c": np.arange(3, 6, dtype="u1"), | ||
"d": np.arange(4.0, 7.0, dtype="float64"), | ||
"e": [True, False, True], | ||
"f": pd.date_range("now", periods=3).values, | ||
|
@@ -128,6 +128,26 @@ def test_select_dtypes_exclude_include_using_list_like(self): | |
e = df[["b", "e"]] | ||
tm.assert_frame_equal(r, e) | ||
|
||
@pytest.mark.parametrize( | ||
"include", [(np.bool_, "int"), (np.bool_, "integer"), ("bool", int)] | ||
) | ||
def test_select_dtypes_exclude_include_int(self, include): | ||
# Fix select_dtypes(include='int') for Windows, FYI #36596 | ||
df = DataFrame( | ||
{ | ||
"a": list("abc"), | ||
"b": list(range(1, 4)), | ||
"c": np.arange(3, 6, dtype="int32"), | ||
"d": np.arange(4.0, 7.0, dtype="float64"), | ||
"e": [True, False, True], | ||
"f": pd.date_range("now", periods=3).values, | ||
} | ||
) | ||
exclude = (np.datetime64,) | ||
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. can you parameterize on these types (e.g. you can add include & excude as paramters), the this is much simpler to grok. 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. Yes, that will be nicer for sure. I updated this pull request with the requested changes. |
||
result = df.select_dtypes(include=include, exclude=exclude) | ||
expected = df[["b", "c", "e"]] | ||
tm.assert_frame_equal(result, expected) | ||
|
||
def test_select_dtypes_include_using_scalars(self): | ||
df = DataFrame( | ||
{ | ||
|
Uh oh!
There was an error while loading. Please reload this page.