[英]Error in pandas “AttributeError: 'DataFrame' object has no attribute 'round'”
[英]AttributeError: 'DataFrame' object has no attribute 'items' (pandas DataFrame error)
我用來自循環的數據(數據保存在這里)創建了一個 pandas DataFrame。 現在,我想遍歷這個 DataFrame。 但是,當我嘗試像這樣訪問 items() function 時:
frame = pandas.read_csv(data_path + '/file1.csv')
frame.items()
我收到此錯誤:
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'
這特別奇怪,因為 PyCharm 為我提供了填寫items
的選項,如果我只輸入frame.it
這是什么意思?
檢查您的 pycharm 解釋器。 通常,屬性“items”在 Python 3.x 中運行良好,但在 ZA7F5F35426B927411FC92231B563Z 中給出錯誤“AttributeError: 'DataFrame' object has no attribute 'items'”。
我也遇到了同樣的錯誤,直到我意識到我使用的是 Python 2.7 而不是我打算使用的 Python 3.9。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.