I've created a pandas DataFrame with data from loops (data saved here ). Now, I want to iterate over this DataFrame. However, when I try to access the items() function like this:
frame = pandas.read_csv(data_path + '/file1.csv')
frame.items()
I get this error:
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "C:\Python27\ArcGIS10.7\lib\site-packages\pandas\core\generic.py", line 2668, in __getattr__
return object.__getattribute__(self, name)
AttributeError: 'DataFrame' object has no attribute 'items'
This is especially weird since PyCharm offers me the option to fill in items
if I just type frame.it
What does this mean?
Check your pycharm interpreter. Normally the attribute 'items' works well in Python 3.x but gives the error "AttributeError: 'DataFrame' object has no attribute 'items'" in Python 2.7.
I also faced the same error until I realized that I was using Python 2.7 instead of Python 3.9 that I intended to use.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.