Skip to content

Commit b25b0b2

Browse files
committed
add concat function dtype test
Signed-off-by: Liang Yan <[email protected]>
1 parent 178e504 commit b25b0b2

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

pandas/tests/arithmetic/test_datetime64.py

+31
Original file line numberDiff line numberDiff line change
@@ -2436,3 +2436,34 @@ def test_dt64arr_addsub_object_dtype_2d():
24362436

24372437
assert result2.shape == (4, 1)
24382438
assert all(td._value == 0 for td in result2.ravel())
2439+
2440+
2441+
def test_concat_float_datetime64():
2442+
# GH#32934
2443+
df_time = pd.DataFrame({"A": pd.array(["2000"], dtype="datetime64[ns]")})
2444+
df_float = pd.DataFrame({"A": pd.array([1.0], dtype="float64")})
2445+
2446+
tm.assert_equal(
2447+
pd.concat([df_time, df_float]),
2448+
pd.DataFrame(
2449+
{
2450+
"A": [
2451+
pd.array(["2000"], dtype="datetime64[ns]")[0],
2452+
pd.array([1.0], dtype="float64")[0],
2453+
]
2454+
},
2455+
index=[0, 0],
2456+
),
2457+
)
2458+
tm.assert_equal(
2459+
pd.concat([df_time.iloc[:0], df_float.iloc[:0]]),
2460+
pd.DataFrame({"A": pd.array([], dtype="object")}),
2461+
)
2462+
tm.assert_equal(
2463+
pd.concat([df_time.iloc[:0], df_float]),
2464+
pd.DataFrame({"A": pd.array([1.0], dtype="object")}),
2465+
)
2466+
tm.assert_equal(
2467+
pd.concat([df_time, df_float.iloc[:0]]),
2468+
pd.DataFrame({"A": pd.array(["2000"], dtype="datetime64[ns]")}),
2469+
)

0 commit comments

Comments
 (0)