[英]TypeError: raw_input() takes from 1 to 2 positional arguments but 4 were given
[英]TypeError: append() takes from 2 to 5 positional arguments but 8 were given
我正在嘗試創建一個 for 循環來迭代某些文件的操作。 for 循環工作得很好,直到它到達 append 操作。 它給了我以下錯誤:
TypeError: append() 從 2 到 5 個位置 arguments 但給出了 8 個
怎么可能解決這個問題?
>>> index = 0
>>> for value in Sample:
... data = read_file(value)
... #operations
... #operations
... #operations
... Data =pd.DataFrame([[Car_Model, Car_Length, Car_Width, Car_Height, Car_Engine, Manufactured_Year, Purchased_Year]], columns=['Car_Model', 'Car_Length', 'Car_Width', 'Car_Height', 'Car_Engine', 'Manufactured_Year', 'Purchased_Year'])
... Data.append(Car_Model, Car_Length, Car_Width, Car_Height, Car_Engine, Manufactured_Year, Purchased_Year)
... index += 1
從DataFrame.append
的文檔( 鏈接):
DataFrame.append(other, ignore_index=False, verify_integrity=False, sort=False)
如您所見,它需要 5 個參數。 您給 8,這太多了,您的錯誤中也說明了這一點。
要附加的元素在具有以下描述的參數other
中:
其他:DataFrame 或 Series/dict-like object,或這些列表
數據到 append。
警告:文檔還說append
已被棄用:
1.4.0 版后已棄用:改用 concat()。 有關詳細信息,請參閱棄用的 DataFrame.append 和 Series.append
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.