Skip to content

Commit 4953d26

Browse files
committed
Merge branch 'master' of https://github.com/pandas-dev/pandas into npbump
2 parents 366f3ba + 4617389 commit 4953d26

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

pandas/core/frame.py

-1
Original file line numberDiff line numberDiff line change
@@ -8325,7 +8325,6 @@ def blk_func(values):
83258325
result = result.iloc[0].rename(None)
83268326
return result
83278327

8328-
data = self
83298328
if numeric_only is None:
83308329
data = self
83318330
values = data.values

pandas/tests/reshape/test_concat.py

+34
Original file line numberDiff line numberDiff line change
@@ -2768,3 +2768,37 @@ def test_concat_copy_index(test_series, axis):
27682768
comb = concat([df, df], axis=axis, copy=True)
27692769
assert comb.index is not df.index
27702770
assert comb.columns is not df.columns
2771+
2772+
2773+
def test_concat_multiindex_datetime_object_index():
2774+
# https://github.com/pandas-dev/pandas/issues/11058
2775+
s = Series(
2776+
["a", "b"],
2777+
index=MultiIndex.from_arrays(
2778+
[[1, 2], Index([dt.date(2013, 1, 1), dt.date(2014, 1, 1)], dtype="object")],
2779+
names=["first", "second"],
2780+
),
2781+
)
2782+
s2 = Series(
2783+
["a", "b"],
2784+
index=MultiIndex.from_arrays(
2785+
[[1, 2], Index([dt.date(2013, 1, 1), dt.date(2015, 1, 1)], dtype="object")],
2786+
names=["first", "second"],
2787+
),
2788+
)
2789+
expected = DataFrame(
2790+
[["a", "a"], ["b", np.nan], [np.nan, "b"]],
2791+
index=MultiIndex.from_arrays(
2792+
[
2793+
[1, 2, 2],
2794+
DatetimeIndex(
2795+
["2013-01-01", "2014-01-01", "2015-01-01"],
2796+
dtype="datetime64[ns]",
2797+
freq=None,
2798+
),
2799+
],
2800+
names=["first", "second"],
2801+
),
2802+
)
2803+
result = concat([s, s2], axis=1)
2804+
tm.assert_frame_equal(result, expected)

0 commit comments

Comments
 (0)