Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API: Index doesn't results in PeriodIndex if Period contains NaT #13664

Closed
wants to merge 1 commit into from

Conversation

sinhrks
Copy link
Member

@sinhrks sinhrks commented Jul 15, 2016

  • tests added / passed
  • passes git diff upstream/master | flake8 --diff
  • whatsnew entry

This improve Period handling a little.

The below describes the behavior on current master

# this should be PeriodIndex
pd.Index([pd.Period('2011-01', freq='M'), pd.NaT])
# Index([2011-01, NaT], dtype='object')

# this should be object dtype
pd.Index([pd.Period('2011-01', freq='M'), pd.Period('2011-01-01', freq='D')])
# pandas._period.IncompatibleFrequency: Input has different freq=D from PeriodIndex(freq=M)

# this should be object dtype
pd.PeriodIndex(['2011-01', 'NaT'], freq='M').fillna(pd.Period('2011-01-01', freq='D'))
# pandas._period.IncompatibleFrequency: Input has different freq=D from PeriodIndex(freq=M)

@sinhrks sinhrks added API Design Period Period data type labels Jul 15, 2016
@sinhrks sinhrks added this to the 0.19.0 milestone Jul 15, 2016
@sinhrks sinhrks added the Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate label Jul 15, 2016
@jreback jreback closed this in 506520b Jul 19, 2016
@sinhrks sinhrks deleted the period_infer2 branch July 19, 2016 02:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Design Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate Period Period data type
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant