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

'Series' object has no attribute 'items' on Python 2.7 #17671

Closed
mivade opened this issue Sep 25, 2017 · 2 comments
Closed

'Series' object has no attribute 'items' on Python 2.7 #17671

mivade opened this issue Sep 25, 2017 · 2 comments
Labels
Duplicate Report Duplicate issue or pull request

Comments

@mivade
Copy link

mivade commented Sep 25, 2017

Code Sample, a copy-pastable example if possible

Running on the REPL with Python 2.7:

Python 2.7.13 |Continuum Analytics, Inc.| (default, Dec 20 2016, 23:05:08)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>> import pandas as pd
>>> s = pd.Series([1, 2, 3])
>>> for _, x in s.items():
...     print(x)
...
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/depalati/miniconda3/envs/py27/lib/python2.7/site-packages/pandas/core/generic.py", line 2966, in __getattr__
    return object.__getattribute__(self, name)
AttributeError: 'Series' object has no attribute 'items'

On Python 3.6:

Python 3.6.2 |Continuum Analytics, Inc.| (default, Jul 20 2017, 13:14:59)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas as pd
>>> s = pd.Series([1, 2, 3])
>>> for _, x in s.items():
...     print(x)
...
1
2
3
>>>

Problem description

The Series.items method is mysteriously absent on Python 2.7, though Series.iteritems works fine on both legacy and modern Python.

Expected Output

Series.items should iterate over (index, value) tuples.

Output of pd.show_versions()

INSTALLED VERSIONS

commit: None
python: 2.7.13.final.0
python-bits: 64
OS: Darwin
OS-release: 16.0.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: None.None

pandas: 0.20.3
pytest: 3.2.1
pip: 9.0.1
setuptools: 27.2.0
Cython: None
numpy: 1.11.3
scipy: 0.18.1
xarray: None
IPython: 5.1.0
sphinx: None
patsy: None
dateutil: 2.6.0
pytz: 2017.2
blosc: None
bottleneck: None
tables: 3.3.0
numexpr: 2.6.1
feather: None
matplotlib: 1.5.1
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.9.4
s3fs: None
pandas_gbq: None
pandas_datareader: None

@TomAugspurger
Copy link
Contributor

This was fixed (recently) in #17214 and will be in the next release.

@TomAugspurger TomAugspurger added this to the No action milestone Sep 25, 2017
@TomAugspurger TomAugspurger added the Duplicate Report Duplicate issue or pull request label Sep 25, 2017
@mivade
Copy link
Author

mivade commented Sep 25, 2017

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate Report Duplicate issue or pull request
Projects
None yet
Development

No branches or pull requests

2 participants