删除spotfire数据表Iron python上的所有行

2024-10-01 15:37:58 发布

您现在位置:Python中文网/ 问答频道 /正文

我在寻找一种删除SPOTFIRE上数据表中的行的方法,但没有找到合适的方法。在

我试图编写一个脚本来完成它,但它太慢了,我有更多的20k行要删除。在

有人知道为什么它太慢了吗?是否有另一种方法(更快的方法)

from Spotfire.Dxp.Data import RowSelection
table=Document.Data.Tables["my Table name"]
i=0
for row in table.GetRows():
  i+=1
  rowToDelete=Document.Data.Tables["my Table name"].Select("[index]="+`i`).AsIndexSet()
  Document.Data.Tables["my Table name"].RemoveRows(RowSelection(rowToDelete))

Tags: 方法namefrom脚本tablesdatamytable
2条回答

下面是从表中删除所选(标记)行的代码。

from Spotfire.Dxp.Data import RowSelection
DataTable = Document.Data.Tables['NodeCollection']
# selectedNodes - Name of the marking given in spotfire. 
SelectedRows = Document.Data.Markings['selectedNodes'].GetSelection(DataTable)
CollectionTable.RemoveRows(SelectedRows)

我找到了一种更简单的方法。

from Spotfire.Dxp.Data import RowSelection, IndexSet
dtTarget = Document.Data.Tables["my Table name"]
dtTarget.RemoveRows(RowSelection(IndexSet(dtTarget.RowCount,True)))

相关问题 更多 >

    热门问题