Skip to content

TST: More type checking during .(i)loc #44015

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

Closed
Closed
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
15 changes: 11 additions & 4 deletions pandas/tests/indexing/test_iloc.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,20 @@ def test_iloc_setitem_fullcol_categorical(self, indexer, key, using_array_manage
else:
assert cat[0] != "gamma"

def check(frame, expected):
df = frame.copy()
indexer(df)[key, 0] = cat
tm.assert_frame_equal(df, expected)

# TODO with mixed dataframe ("split" path), we always overwrite the column
frame = DataFrame({0: np.array([0, 1, 2], dtype=object), 1: range(3)})
df = frame.copy()
orig_vals = df.values
indexer(df)[key, 0] = cat
expected = DataFrame({0: cat, 1: range(3)})
tm.assert_frame_equal(df, expected)
check(frame, expected)

# Without a mixed dataframe, a the internal block is overwritten
frame = DataFrame({0: np.array([0, 1, 2], dtype=object)})
expected = DataFrame({0: cat})
check(frame, expected)

# TODO(ArrayManager) does not yet update parent
@td.skip_array_manager_not_yet_implemented
Expand Down