8000 CLN/TST: normalize test_frame_apply by rhshadrach · Pull Request #40113 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content
Dismiss alert

CLN/TST: normalize test_frame_apply #40113

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
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
regroup test
  • Loading branch information
rhshadrach committed Feb 27, 2021
commit b11f1a1a3c7ada8e2eebb98521d1dcc4795c902c
8 changes: 4 additions & 4 deletions pandas/tests/apply/test_frame_apply.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,16 @@ def test_apply(float_frame):
assert result[d] == expected
assert result.index is float_frame.index

# GH 9573
df = DataFrame({"c0": ["A", "A", "B", "B"], "c1": ["C", "C", "D", "D"]})
result = df.apply(lambda ts: ts.astype("category"))

# invalid axis
df = DataFrame([[1, 2, 3], [4, 5, 6], [7, 8, 9]], index=["a", "a", "c"])
msg = "No axis named 2 for object type DataFrame"
with pytest.raises(ValueError, match=msg):
df.apply(lambda x: x, 2)

# GH 9573
df = DataFrame({"c0": ["A", "A", "B", "B"], "c1": ["C", "C", "D", "D"]})
result = df.apply(lambda ts: ts.astype("category"))

assert result.shape == (4, 2)
assert isinstance(result["c0"].dtype, CategoricalDtype)
assert isinstance(result["c1"].dtype, CategoricalDtype)
Expand Down
0