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

'items' can not be the column name of a DataFrame? #14009

Closed
WenWeiKun-byte opened this issue Aug 16, 2016 · 1 comment
Closed

'items' can not be the column name of a DataFrame? #14009

WenWeiKun-byte opened this issue Aug 16, 2016 · 1 comment

Comments

@WenWeiKun-byte
Copy link

Code Sample, a copy-pastable example if possible

df = pd.DataFrame({'items':[1,2,3], 'test': [2,3,4]})
df.items

Expected Output

0    1
1    2
2    3
Name: items, dtype: int64

Given Output

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

output of pd.show_versions()

INSTALLED VERSIONS

commit: None
python: 2.7.12.final.0
python-bits: 64
OS: Windows
OS-release: 10
machine: AMD64
processor: Intel64 Family 6 Model 60 Stepping 3, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None

pandas: 0.17.0
nose: 1.3.7
pip: 8.1.2
setuptools: 7.0
Cython: 0.24.1
numpy: 1.9.3
scipy: 0.16.0
statsmodels: 0.6.1
IPython: 5.0.0
sphinx: 1.4.1
patsy: 0.4.1
dateutil: 2.5.3
pytz: 2016.6.1
blosc: None
bottleneck: 1.0.0
tables: 3.2.2
numexpr: 2.4.4
matplotlib: 1.4.3
openpyxl: 2.3.2
xlrd: 1.0.0
xlwt: 1.1.2
xlsxwriter: 0.9.2
lxml: 3.6.1
bs4: 4.3.2
html5lib: 0.9999999
httplib2: None
apiclient: None
sqlalchemy: 1.0.13
pymysql: 0.6.6.None
psycopg2: None

@TomAugspurger
Copy link
Contributor

Probably related to #13918

You should use df['items'] for accessing columns, df.items is a convenient shortcut, but may conflict with DataFrame methods. This one is a bit special since it's IIRC .items is a method on py3 but not py2.

@jreback jreback closed this as completed Aug 16, 2016
@jreback jreback added this to the No action milestone Aug 16, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants