When we pass a list of numbers, it parsed as date as it is. The same values is regarded as ordinal if it is passed as an array.

Code Sample, a copy-pastable example if possible

raw = [2005, 2007, 2009]

pd.PeriodIndex(raw, freq='A')
# PeriodIndex(['2005', '2007', '2009'], dtype='period[A-DEC]', freq='A-DEC')

pd.PeriodIndex(np.array(raw), freq='A')
# PeriodIndex(['3975', '3977', '3979'], dtype='period[A-DEC]', freq='A-DEC')

Expected Output

Because PeriodIndex has a data and ordinal arg, it should be regarded as: - date if it is passed via data kwd - ordinal if it is passed via ordinal kwd

output of pd.show_versions()

on current master.

Comment From: jreback

yeah these should be the same. construction of PeriodIndex from integers must be to the codes. Other dtypes can be interpreted (e.g. strings). We could have some flexibility in a to_period method (which can/should be the public interface).

Comment From: jreback

IIRC we discussed this somewhere else, pls link it if you can find it.

Comment From: max-sixty

ref https://github.com/pydata/pandas/pull/13277

Comment From: TomAugspurger

This has been fixed somewhere along the way.

In [37]: pd.PeriodIndex(np.array(raw), freq='A')
    ...:
Out[37]: PeriodIndex(['2005', '2007', '2009'], dtype='period[A-DEC]', freq='A-DEC')

I think that things are reasonable well tested, so closing.