[英]TypeError: append() takes no keyword arguments
我真的是 Python 的初學者,我正在做一個項目,我必須提取建築物的所有元素。 為此,我編寫了代碼:
import ifcopenshell.geom
import ifcopenshell.util
from ifcopenshell.util.selector import Selector
selector = Selector()
import ifcopenshell.util.element as util
import pandas as pd
import ifcopenshell
ifc = ifcopenshell.open('FHZGR_PONTE DELL`ACCADEMIA_PH01_BEM.ifc')
ifc
接着:
elements = selector.parse(ifc, '.IfcWall | .IfcSlab | .IfcWindow | .IfcDoor | .IfcRamp | .IfcColumn | .IfcBeam | .IfcStair')
elements
然后:
l = []
for element in elements:
l.append(elements, columns = ['Klasse', 'Typ', 'Objekt', 'ID'])
l
df = pd.DataFrame(l)
df
但最后的代碼行返回給我:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Input In [17], in <cell line: 2>()
1 l = []
2 for element in elements:
----> 3 l.append(elements, columns = ['Klasse', 'Typ', 'Objekt', 'ID'])
4 l
5 df = pd.DataFrame(l)
TypeError: append() takes no keyword arguments
有人可以幫忙解決問題嗎?
您要追加到列表中,唯一的參數append
將元素追加到列表中。
l = []
for element in elements:
l.append(element)
請參閱有關可變序列類型(包括list
)的文檔。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.