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

DEPR: Series/DataFrame/HDFStore.iteritems() #45321

Merged
merged 13 commits into from
Jan 16, 2022

Conversation

mroeschke
Copy link
Member

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

@mroeschke mroeschke added the Deprecate Functionality to remove in pandas label Jan 12, 2022
@jreback jreback added this to the 1.5 milestone Jan 13, 2022
@jreback jreback added the IO HDF5 read_hdf, HDFStore label Jan 13, 2022
@mroeschke mroeschke changed the title DEPR: Series.keys() & Series/DataFrame/HDFStore.iteritems() DEPR: Series/DataFrame/HDFStore.iteritems() Jan 13, 2022
@jreback jreback merged commit e255e56 into pandas-dev:main Jan 16, 2022
@mroeschke mroeschke deleted the depr/iteritems/keys branch January 16, 2022 18:58
@jorisvandenbossche
Copy link
Member

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
Copy link
Member Author

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
Copy link
Member

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
Copy link
Member Author

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
Copy link
Contributor

jreback commented Jan 19, 2022

-1 on interitems this deprecated in python itself

sryza pushed a commit to dagster-io/dagster that referenced this pull request Mar 1, 2023
### Summary & Motivation

Fixes #12604

`.iteritems` is [deprecated since 1.50
](https://pandas.pydata.org/docs/whatsnew/v1.5.0.html#other-deprecations)
and will be removed in a future version. Changing to `.items`.
(pandas-dev/pandas#45321).

### How I Tested These Changes

I did not, but pandas-dev/pandas#45321 appears
to indicate it's a safe change to make. If I can somehow install this
version of dagster on my machine, I'm happy to test using the code that
surfaced the issue, but I'm not sure how to do that.
bbimber added a commit to bbimber/demuxEM that referenced this pull request Aug 14, 2023
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 IO HDF5 read_hdf, HDFStore
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants