Skip to content
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
Removed list-like object check
based on the comments, i have removed the list-like objects check
  • Loading branch information
R1j1t committed Sep 20, 2019
commit ef1b9cd729ee82bf8198e58acc9fec7d74177341
46 changes: 0 additions & 46 deletions pandas/tests/reshape/test_reshape.py
Original file line number Diff line number Diff line change
Expand Up @@ -608,52 +608,6 @@ def test_get_dummies_all_sparse(self):
)
tm.assert_frame_equal(result, expected)

@pytest.mark.parametrize(
"values",
[
["baz", "zoo"],
np.array(["baz", "zoo"]),
pd.Series(["baz", "zoo"]),
pd.Index(["baz", "zoo"]),
],
)
def test_get_dummies_with_list_like_values(self, values):
# issue #28383
df = pd.DataFrame(
{
"bar": [1, 2, 3, 4, 5, 6],
"foo": ["one", "one", "one", "two", "two", "two"],
"baz": ["A", "B", "C", "A", "B", "C"],
"zoo": ["x", "y", "z", "q", "w", "t"],
}
)

result = pd.get_dummies(df, columns=values, dtype="int64")

data = [
[1, "one", 1, 0, 0, 0, 0, 0, 1, 0, 0],
[2, "one", 0, 1, 0, 0, 0, 0, 0, 1, 0],
[3, "one", 0, 0, 1, 0, 0, 0, 0, 0, 1],
[4, "two", 1, 0, 0, 1, 0, 0, 0, 0, 0],
[5, "two", 0, 1, 0, 0, 0, 1, 0, 0, 0],
[6, "two", 0, 0, 1, 0, 1, 0, 0, 0, 0],
]
columns = [
"bar",
"foo",
"baz_A",
"baz_B",
"baz_C",
"zoo_q",
"zoo_t",
"zoo_w",
"zoo_x",
"zoo_y",
"zoo_z",
]
expected = DataFrame(data=data, columns=columns)
tm.assert_frame_equal(result, expected)

@pytest.mark.parametrize("values", ["baz", "zoo"])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are these two values testing meaningfully distinct cases?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought of adding 2 different values just for the check but they are testing the same case. I will remove it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only one now!

def test_get_dummies_with_string_values(self, values):
# issue #28383
Expand Down