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 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
14 changes: 14 additions & 0 deletions pandas/tests/dtypes/test_concat.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,17 @@ def test_concat_periodarray_2d():

with pytest.raises(ValueError, match=msg):
_concat.concat_compat([arr[:2], arr[2:]], axis=1)


def test_concat_float_datetime():

Copy link
Member

Choose a reason for hiding this comment

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

Please add gh reference at the top, like GH#issue_number

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.iloc[:0], df_float.iloc[:0]])["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.

Could you please check the whole DataFrame?


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