Skip to content

add test to check type of df column after loc() #47264

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 5 commits into from
Jun 13, 2022
Merged
Changes from 2 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
7 changes: 7 additions & 0 deletions pandas/tests/indexing/test_loc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2869,6 +2869,13 @@ def test_loc_setitem_using_datetimelike_str_as_index(fill_val, exp_dtype):
tm.assert_index_equal(df.index, expected_index, exact=True)


def test_loc_set_int_dtype():
df = pd.DataFrame([list("abc")])
df.loc[:, "col1"] = int(5)

assert str(df.dtypes["col1"]) == "int64"


class TestLocSeries:
@pytest.mark.parametrize("val,expected", [(2**63 - 1, 3), (2**63, 4)])
def test_loc_uint64(self, val, expected):
Expand Down