我有一个spsspython脚本,它遍历一个表,读取特定列的每一行值,并相应地设置参数值。目前,我使用getValueAt(rowIndex,colIndex)访问值。但是,必须引用列索引而不是列名并不理想,因为表列可能会发生移动。有没有一种方法可以根据列名引用值?在
示例代码
diagram = modeler.script.diagram()
for i in range(nrows):
jobid = job_rowset.getValueAt(i, 0);
city = job_rowset.getValueAt(i, 3);
country = job_rowset.getValueAt(i, 4);
diagram.setParameterValue ('BU', bu)
diagram.setParameterValue ('City_Param', city)
diagram.setParameterValue ('CountryID_Param', country)
感谢任何帮助!谢谢您!在
假设第一行将包含名称(或者您有指定列顺序的可用内容),则可以构造一个以列名为键和列编号值的字典。在
这样可以得到如下结果:
相关问题 更多 >
编程相关推荐