Skip to content

Commit 753f3e6

Browse files
committed
Addressed code review comment
constructed exact expected dataframe for asserting
1 parent eebc0c8 commit 753f3e6

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pandas/tests/indexing/test_iloc.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
interval_range,
2828
isna,
2929
to_datetime,
30+
Timestamp
3031
)
3132
import pandas._testing as tm
3233
from pandas.api.types import is_scalar
@@ -1196,7 +1197,7 @@ def test_iloc_setitem_multicolumn_to_datetime(self):
11961197

11971198
df.iloc[:, [0]] = DataFrame({"A": to_datetime(["2021", "2022"])})
11981199
expected = DataFrame(
1199-
{"A": to_datetime(["2021", "2022"]), "B": ["2021", "2022"]}
1200+
{"A": [Timestamp("2021-01-01 00:00:00"), Timestamp("2022-01-01 00:00:00")], "B": ["2021", "2022"]}, dtype=object
12001201
)
12011202
tm.assert_frame_equal(df, expected, check_dtype=False)
12021203

@@ -1382,9 +1383,9 @@ def test_frame_iloc_setitem_callable_multicolumn_to_datetime(self):
13821383

13831384
df.iloc[:, [0]] = df.iloc[:, [0]].apply(to_datetime)
13841385
expected = DataFrame(
1385-
{"A": to_datetime(["2022-01-01", "2022-01-02"]), "B": ["2021", "2022"]}
1386+
{"A": [Timestamp("2022-01-01 00:00:00"), Timestamp("2022-01-02 00:00:00")], "B": ["2021", "2022"]}, dtype=object
13861387
)
1387-
tm.assert_frame_equal(df, expected, check_dtype=False)
1388+
tm.assert_frame_equal(df, expected)
13881389

13891390

13901391
class TestILocSeries:

0 commit comments

Comments
 (0)