Skip to content

DEPR: PeriodIndex.astype(dt64) #44398

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

Merged
merged 2 commits into from
Nov 14, 2021
Merged

Conversation

jbrockmendel
Copy link
Member

  • closes #xxxx
  • tests added / passed
  • Ensure all linting tests pass, see here for how to run them
  • whatsnew entry

Match the Series/EA behavior

@jreback jreback added Deprecate Functionality to remove in pandas Period Period data type labels Nov 14, 2021
@jreback jreback added this to the 1.4 milestone Nov 14, 2021
@jreback jreback merged commit 08c4a82 into pandas-dev:master Nov 14, 2021
@simonjayhawkins
Copy link
Member

web and docs failing

2021-11-11T21:46:19.7568073Z WARNING: 
2021-11-11T21:46:19.7569269Z >>>-------------------------------------------------------------------------
2021-11-11T21:46:19.7570278Z Warning in /home/runner/work/pandas/pandas/doc/source/user_guide/timeseries.rst at block ending on line 2098
2021-11-11T21:46:19.7571558Z Specify :okwarning: as an option in the ipython:: block to suppress this message
2021-11-11T21:46:19.7573968Z ----------------------------------------------------------------------------
2021-11-11T21:46:19.7576034Z <ipython-input-382-a92cd46ab454>:1: FutureWarning: Converting PeriodIndex to DatetimeIndex with 'astype' is deprecated and will raise in a future version. Use `obj.to_timestamp(how).tz_localize(dtype.tz)` instead.
2021-11-11T21:46:19.7577328Z   pi.astype("datetime64[ns]")
2021-11-11T21:46:19.7578226Z <<<-------------------------------------------------------------------------

@jbrockmendel
Copy link
Member Author

Yah, this was premature. I didn't fix the docbuild bc I was having second thoughts. Trouble is that we do allow dt64.astype(period), and we should either have both or neither. The part I have a strong opinion about is that IF we allow period.astype(dt64), it should be in PeriodArray.astype, not in PeriodIndex.astype

@jreback
Copy link
Contributor

jreback commented Nov 14, 2021

ok can revert for now if like

nickleus27 pushed a commit to nickleus27/pandas that referenced this pull request Nov 28, 2021
@jbrockmendel jbrockmendel deleted the pi-astype branch December 24, 2021 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Deprecate Functionality to remove in pandas Period Period data type
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants