Skip to content
Merged
Show file tree
Hide file tree
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
8 changes: 7 additions & 1 deletion pandas/core/dtypes/cast.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import warnings

from pandas._libs import tslib, lib, tslibs
from pandas._libs.tslibs import iNaT, OutOfBoundsDatetime
from pandas._libs.tslibs import iNaT, OutOfBoundsDatetime, Period
from pandas.compat import string_types, text_type, PY3
from .common import (ensure_object, is_bool, is_integer, is_float,
is_complex, is_datetimetz, is_categorical_dtype,
Expand Down Expand Up @@ -164,6 +164,12 @@ def trans(x): # noqa
result = to_datetime(result).tz_localize('utc')
result = result.tz_convert(dtype.tz)

elif dtype.type == Period:
# TODO(DatetimeArray): merge with previous elif
from pandas.core.arrays import PeriodArray

return PeriodArray(result, freq=dtype.freq)

except Exception:
pass

Expand Down
1 change: 0 additions & 1 deletion pandas/tests/frame/test_combine_concat.py
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,6 @@ def test_combine_first_timedelta(self):
tm.assert_frame_equal(res, exp)
assert res['TD'].dtype == 'timedelta64[ns]'

@pytest.mark.xfail(reason="GH-23079", strict=True)
def test_combine_first_period(self):
data1 = pd.PeriodIndex(['2011-01', 'NaT', '2011-03',
'2011-04'], freq='M')
Expand Down