removed compat check for Series.items method
State: closed

Should I add something in the whatsnew?  
I couldn't find a relevant test, so this is to check if this breaks any tests in CI.
- [x] closes #13918
- [x] tests added / passed
- [x] passes `git diff upstream/master | flake8 --diff`
- [x] whatsnew entry


Labels:

Comments:
can you add a test for this (see where Series.iteritems is test)

yes would need a release note

I wasn't sure how was best to test this (still very new to pandas development) - is this OK?

ok this looks reasonable, ping when green.

It would be nice to do the same for `DataFrame.items()` in this PR if you have time

Oh yeah, sure I can add `DataFrame.items()` in this PR - might take a little while as I am nearing 48 hours without sleep now (you can probably tell...), and bed is calling me.

## [Current coverage](https://codecov.io/gh/pydata/pandas/pull/13920?src=pr) is 85.26% (diff: 100%)

> No coverage report found for **master** at 1919e26.
> 
> Powered by [Codecov](https://codecov.io?src=pr). Last update [1919e26...d6d93ba](https://codecov.io/gh/pydata/pandas/compare/1919e26ead5d156c2b505a0ad8d233b02eb1b573...d6d93bafe2391c1add5660b86b8069ec453ab2a1?src=pr)

@richlewis42 Can you update this?

Ahh sorry completely fell off my todo list. First thing tomorrow, I will finish this.

@jreback This looks ready now.  Is everything good?

minorr change. lgtm.

I am concerned that `.items()` does not return the expected result on Python 2. It would seem more consistent to write a list of items on Python 2 rather than an iterator.

@jreback I added the comment

@shoyer I think you are right, there is a PY2/PY3 inconsistency introduced here, and this requires more thought (sorry for leaving this around for so long, been very  busy at work).

How I see this:

For dictionaries:

| method | PY2 | PY3 |
| --- | --- | --- |
| `items` | not lazy | lazy |
| `iteritems` | lazy | not implemented |

Currently in pandas for `Series` and `DataFrames`:

| method | PY2 | PY3 |
| --- | --- | --- |
| `items` | not implemented | lazy |
| `iteritems` | lazy | lazy |

In my opinion, PY3's `compat.iteritems` should be deprecated (or just left as is), and we should implement a `compat.items` which is not lazy for PY2 but is for PY3. Is that a better solution? @jreback @jorisvandenbossche  what do you think?

---

### Python 2

``` python
>>> d = dict(a=4, b=6)

>>> d.items()
[('a', 4), ('b', 6)]

>>> d.iteritems()
<dictionary-itemiterator at 0x10bedf310>

>>> s = pd.Series(d)

>>> s.items()
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-5-615b57d0112e> in <module>()
----> 1 s.items()

/Users/rich/anaconda/envs/python2/lib/python2.7/site-packages/pandas/core/generic.pyc in __getattr__(self, name)
   2239                 or name in self._metadata
   2240                 or name in self._accessors):
-> 2241             return object.__getattribute__(self, name)
   2242         else:
   2243             if name in self._info_axis:

AttributeError: 'Series' object has no attribute 'items'

>>> s.iteritems()
<itertools.izip at 0x10bfec488>

>>> df = s.reset_index()

>>> df.items()
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-8-952a7e29c4b1> in <module>()
----> 1 df.items()

/Users/rich/anaconda/envs/python2/lib/python2.7/site-packages/pandas/core/generic.pyc in __getattr__(self, name)
   2239                 or name in self._metadata
   2240                 or name in self._accessors):
-> 2241             return object.__getattribute__(self, name)
   2242         else:
   2243             if name in self._info_axis:

AttributeError: 'DataFrame' object has no attribute 'items'

>>> df.iteritems()
<generator object iteritems at 0x10bfe96e0>
```

#### Python 3

``` python
>>> d = dict(a=4, b=6)

>>> d.items()
dict_items([('b', 6), ('a', 4)])

>>> d.iteritems()
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-3-6c1b1c343924> in <module>()
----> 1 d.iteritems()

AttributeError: 'dict' object has no attribute 'iteritems'

>>> s = pd.Series(d)

>>> s.items()
<zip at 0x10686e388>

>>> s.iteritems()
<zip at 0x11e05c788>

>>> df = s.reset_index()

>>> df.items()
<generator object DataFrame.iteritems at 0x11deeb0f8>

>>> df.iteritems()
<generator object DataFrame.iteritems at 0x11dea2888>
```

@richlewis42 `compat.items` sounds fine to me. It _is_ possible this already exists in `six` and was never included in our impl (which is included inline in `compat/__init__.py`).

can you rebase / update

can you update

@richlewis42 can you rebase / update.

I think we do need to make a non-lazy PY2 ``.items()`` for compat. (maybe something exists in ``pandas.compat`` for this? or in ``six`` which we can bring over.
Hi @jreback sorry my bad somehow wasn't getting these updates.  I'll have a look as soon as I can, I'm but I'm afraid I'm writing up my PhD at the moment so really busy.  
closing as stale. please ping if you'd like to continue.