DEPR: deprecate exposing blocks in core.internals by jbrockmendel · Pull Request #55139 · pandas-dev/pandas (original) (raw)

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 andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation6 Commits18 Checks0 Files changed

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

jbrockmendel

Motivation: tried to clean up the blocks code bc DatetimeTZBlock and DatetimeLikeBlock are no longer really needed. Found that we can't do that bc DatetimeTZBlock is exposed in the pseudo-public API. That got me looking at internals.__init__, where comments suggest that we are importing the block subclasses for io.pytables (which no longer needs them) and io.packers (which no longer exists). So we could remove them directly, but apparently a recent PR deprecated NumericBlock and ObjectBlock so this piggy-backs on that deprecation (and adds a missing test).

In internals.api I need to deprecate DatetimeTZBlock in order to eventually get rid of it entirely. Also deprecating Block and ExtensionBlock is orthogonal just to wean downstream packages off of them.

cc @jorisvandenbossche

xref #40226

jreback

- Changed :meth:`Timedelta.resolution_string` to return ``h``, ``min``, ``s``, ``ms``, ``us``, and ``ns`` instead of ``H``, ``T``, ``S``, ``L``, ``U``, and ``N``, for compatibility with respective deprecations in frequency aliases (:issue:`52536`)
^^^^^^^^^^^^^^^^^^

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doc issue

@jbrockmendel

@jbrockmendel

@jorisvandenbossche

As mentioned in #40226, pyarrow accesses DateimeTZBlock, but never instantiates it. So in theory that use case could easily be kept without a full working class. Now, the only reason we were using it was to pass it to make_block, and that's something we can easily remove in pyarrow, which I am doing in apache/arrow#38321.
So from pyarrow's point of view, this deprecation is fine.

@jbrockmendel

If there are no more comments, I plan to merge this in a week.

@jbrockmendel

jorisvandenbossche

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't comment on the exact line, but can you fix the stacklevel to 2 for this DeprecationWarning?

@jbrockmendel

Can't comment on the exact line, but can you fix the stacklevel to 2 for this DeprecationWarning?

Updated. Can you confirm this is what you have in mind

@jbrockmendel

@jorisvandenbossche

jorisvandenbossche

phofl pushed a commit to phofl/pandas that referenced this pull request

Nov 21, 2023

@jbrockmendel @phofl

Labels

Deprecate

Functionality to remove in pandas

Internals

Related to non-user accessible pandas implementation