我有一个数据帧的集合,(即集群)存储在一个列表中
目标:我需要将一个序列对象remaining_attr[i]
添加到具有最高规范化互信息分数的数据帧cluster
我的问题是,我通过将最佳集群存储在变量best_cluster
中来跟踪它。这只是返回一个新的数据帧,而不是列表中包含的数据帧,即cluster_list[cluster]
。在存储中间变量best_cluster: TypeError: list indices must be integers or slices, not DataFrame
时,我还收到了错误消息
如何将series对象添加到列表中的max_nmis数据帧中
for i in remaining_attr:
max_nmis = 0
for cluster in cluster_list:
for j in cluster:
nmis = nmis(remaining_attr[i], cluster[j], average_method='arithmetic')
if nmis > max_nmis:
max_nmis = nmis
best_cluster = cluster_list[cluster] <---------the problem
best_cluster.join(remaining_attr[i], inplace = True)
目前没有回答
相关问题 更多 >
编程相关推荐