BUG: periodindex converted to Series incorrectly getting coerce to int64 · Issue #7932 · pandas-dev/pandas (original) (raw)
In [47]: span
Out[47]:
<class 'pandas.tseries.period.PeriodIndex'>
[2012-12-31, ..., 9999-12-31]
Length: 3, Freq: D
In [48]: Series(span)
Out[48]:
0 15705
1 16404
2 2932896
dtype: int64
In [49]: Series(span.asobject)
Out[49]:
0 2012-12-31
1 2014-11-30
2 9999-12-31
dtype: object
I believe this works correctly if its a setitem in a frame, e.g.
df['span'] = span
but not in the Series
constructor, needs this: https://github.com/pydata/pandas/blob/master/pandas/core/series.py#L2436 called in the Series.__init__