-
-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
items method only exists in python3 #17213
Labels
Milestone
Comments
tacaswell
added a commit
to tacaswell/pandas
that referenced
this issue
Aug 10, 2017
Closes pandas-dev#17213 This leaves a slight semantic difference between `dict.items` and `DateFrame.items` in python2, however there is no code currently expecting `DataFrame.items` to return a list and in python3 there is no `dict.iteritems`. This eases writing 'native' python3 code that also runs under python2.
@tacaswell : Yeah...that's awkward. I see you've already made a commit to standardize this, which is great! |
4 tasks
dupe of #13918 |
tacaswell
added a commit
to tacaswell/pandas
that referenced
this issue
Aug 19, 2017
Closes pandas-dev#17213 This leaves a slight semantic difference between `dict.items` and `DateFrame.items` in python2, however there is no code currently expecting `DataFrame.items` to return a list and in python3 there is no `dict.iteritems`. This eases writing 'native' python3 code that also runs under python2.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Code Sample, a copy-pastable example if possible
Problem description
This works on python3 and fails on python2. This seems like a natural thing to do to have easy duck-typing between dataframes and dicts of iterables.
Either the docs should be updated to flag this as a python3 only feature or
items
should be shimmed onto DataFrames for all versions of python. In python2 this would have different semantics thandict.item
given DataFrame has not haditem
before you are not changing behavior and the 'iterator-not-a-list' semantics are better.It looks like the initial shim came in via 16dbeab .
As a side-note,
six.iteritems
works as expected on DataFrames.Expected Output
it does not raise.
Output of
pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 2.7.13.final.0
python-bits: 64
OS: Linux
OS-release: 4.11.9-1-ARCH
machine: x86_64
processor:
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: None.None
pandas: 0.20.3
pytest: 3.2.0
pip: 9.0.1
setuptools: 36.2.2.post20170724
Cython: None
numpy: 1.13.1
scipy: 0.19.1
xarray: None
IPython: 5.3.0
sphinx: None
patsy: None
dateutil: 2.6.1
pytz: 2017.2
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: 2.0.2
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.9.5
s3fs: None
pandas_gbq: None
pandas_datareader: None
The text was updated successfully, but these errors were encountered: