我有一个树状图,我希望能够列出叶子值或列表值而不必费力地将它们制成
我正在尝试根据颜色分组。下面的代码返回未定义defaultdict的错误 编辑:现在它告诉我元组对象不可调用
cluster_idxs = defaultdict(list)
for c, pi in zip(den['color_list'], den['icoord']):
for leg in pi[1:3]:
i = (leg - 5.0) / 10.0
if abs(i - int(i)) < 1e-5:
cluster_idxs[c].append(int(i))
TypeErrorTraceback (most recent call last)
<ipython-input-47-76b947227db4> in <module>()
----> 1 cluster_idxs = defaultdict(list)
2 for c, pi in zip(den['color_list'], den['icoord']):
3 for leg in pi[1:3]:
4 i = (leg - 5.0) / 10.0
5 if abs(i - int(i)) < 1e-5:
TypeError: 'tuple' object is not callable