Skip to content

Commit

Permalink
TST: test selection methods after assignment with at (pandas-dev#43843)
Browse files Browse the repository at this point in the history
  • Loading branch information
saehuihwang authored Oct 2, 2021
1 parent ef31301 commit 4f9b3ea
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions pandas/tests/indexing/test_at.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,27 @@ def test_at_timezone():
tm.assert_frame_equal(result, expected)


def test_selection_methods_of_assigned_col():
# GH 29282
df = DataFrame(data={"a": [1, 2, 3], "b": [4, 5, 6]})
df2 = DataFrame(data={"c": [7, 8, 9]}, index=[2, 1, 0])
df["c"] = df2["c"]
df.at[1, "c"] = 11
result = df
expected = DataFrame({"a": [1, 2, 3], "b": [4, 5, 6], "c": [9, 11, 7]})
tm.assert_frame_equal(result, expected)
result = df.at[1, "c"]
assert result == 11

result = df["c"]
expected = Series([9, 11, 7], name="c")
tm.assert_series_equal(result, expected)

result = df[["c"]]
expected = DataFrame({"c": [9, 11, 7]})
tm.assert_frame_equal(result, expected)


class TestAtSetItem:
def test_at_setitem_mixed_index_assignment(self):
# GH#19860
Expand Down

0 comments on commit 4f9b3ea

Please sign in to comment.