Skip to content

TST: Groupby first/last/nth nan column test #33627

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
Apr 23, 2020
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
11 changes: 11 additions & 0 deletions pandas/tests/groupby/test_nth.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,17 @@ def test_first_last_nth_dtypes(df_mixed_floats):
assert f.dtype == "int64"


def test_first_last_nth_nan_dtype():
# GH 33591
df = pd.DataFrame({"data": ["A"], "nans": pd.Series([np.nan], dtype=object)})

grouped = df.groupby("data")

assert grouped["nans"].first().dtype == object
assert grouped["nans"].last().dtype == object
assert grouped["nans"].nth(0).dtype == object


def test_first_strings_timestamps():
# GH 11244
test = pd.DataFrame(
Expand Down