Skip to content

Commit a3273b2

Browse files
code sample for pandas-dev#40841
1 parent 7448a19 commit a3273b2

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

bisect/40841.py

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# BUG: AssertionError: <class 'pandas.core.arrays.datetimes.DatetimeArray'> on
2+
# concat #40841
3+
4+
import numpy as np
5+
import pandas as pd
6+
7+
import pandas.testing as tm
8+
9+
print(pd.__version__)
10+
11+
right = pd.DataFrame(
12+
data={"C": [0.5274]},
13+
index=pd.DatetimeIndex(
14+
["2021-04-08 21:21:14+00:00"],
15+
dtype="datetime64[ns, UTC]",
16+
name="Time (UTC)",
17+
freq=None,
18+
),
19+
)
20+
21+
left = pd.DataFrame(
22+
data={"A": [None], "B": [np.nan]},
23+
index=pd.Index([None], dtype="object", name="Maybe Time (UTC)"),
24+
)
25+
26+
result = pd.concat([left, right], axis="columns")
27+
print(result)
28+
29+
expected = pd.DataFrame(
30+
{"A": [None, None], "B": [np.nan, np.nan], "C": [np.nan, 0.5274]},
31+
index=pd.Index([pd.NaT, pd.Timestamp("2021-04-08 21:21:14+00:00")], dtype="object"),
32+
)
33+
34+
tm.assert_frame_equal(result, expected)

0 commit comments

Comments
 (0)