DEPR: Series/DataFrame/HDFStore.iteritems() by mroeschke · Pull Request #45321 · 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

Conversation5 Commits13 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 }})

mroeschke

@mroeschke

@mroeschke

@mroeschke mroeschke changed the titleDEPR: Series.keys() & Series/DataFrame/HDFStore.iteritems() DEPR: Series/DataFrame/HDFStore.iteritems()

Jan 13, 2022

@mroeschke

@jorisvandenbossche

What's the reasoning to deprecate iteritems()?

I suppose it is the duplication with items()? On the other hand, iteritems() also gives some consistency with iterrows and itertuples, which could be a reason in favor to rather keep iteritems()?

@mroeschke

The duplication with items() was the motivation.

I think iteritems() was designed to mirror Python's dict API in 2.7, and since that was removed in PY3 I chose to remove iteritems(). (I encountered evidence of this when I tried deprecating Series/DataFrame.keys, and an internal path was flexibly accepting a dict-like API)

@jorisvandenbossche

when I tried deprecating Series/DataFrame.keys

Do you still have plans to propose that? Or the problems you encountered were sufficient to drop the idea?
(if we would like to deprecate .keys() (I personally never use it), that would be another reason to keep iteritems(), I would say)

@mroeschke

Yeah it was tricky to deprecate keys() since:

In [3]: pd.core.dtypes.inference.is_dict_like(Series([1]))
Out[3]: True

In [4]: pd.core.dtypes.inference.is_dict_like(DataFrame([1]))
Out[4]: True

in which keys is an attribute is_dict_like checks. So it may be API breaking / a lot of effort if keys were deprecated.

@jreback

-1 on interitems this deprecated in python itself

sryza pushed a commit to dagster-io/dagster that referenced this pull request

Mar 1, 2023

@sethkimmel3

@etal etal mentioned this pull request

Jun 23, 2023

bbimber added a commit to bbimber/demuxEM that referenced this pull request

Aug 14, 2023

@bbimber