Skip to content

Added dtype test concat function #44927

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
wants to merge 3 commits into from
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
12 changes: 12 additions & 0 deletions pandas/tests/arithmetic/test_datetime64.py
Original file line number Diff line number Diff line change
Expand Up @@ -2494,3 +2494,15 @@ def test_dt64arr_addsub_object_dtype_2d():
assert result2.shape == (4, 1)
assert result2.freq is None
assert (result2.asi8 == 0).all()


def test_concat_float_datetime64():
# GH Issue number #32934
df_time = pd.DataFrame({"A": pd.array(["2000"], dtype="datetime64[ns]")})
df_float = pd.DataFrame({"A": pd.array([1.0], dtype="float64")})

assert pd.concat([df_time, df_float])["A"].dtype == object
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please test the whole DataFrame not only the dtype

assert pd.concat([df_time.iloc[:0], df_float.iloc[:0]])["A"].dtype == object
assert pd.concat([df_time.iloc[:0], df_float.iloc[:0]])["A"].dtype == object
assert pd.concat([df_time.iloc[:0], df_float])["A"].dtype == object
assert pd.concat([df_time, df_float.iloc[:0]])["A"].dtype == object