LDA分析用numpy写入主题时出错

对英文文本进行LDA分析后,用numpy写入主题时,显示list indices must be integers or slices, not str

python
topic = []
for t in topics:
    topic.append("Topic #"+str(list(t).index(np.max(t))))
data['概率最大的主题序号']=topic
data['每个主题对应概率']=list(topics)
data.to_excel("data_topic.xlsx",index=False)


结果报错


```python
TypeError                                 Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_15732/156998731.py in <module>
      2 for t in topics:
      3     topic.append("Topic #"+str(list(t).index(np.max(t))))
----> 4 data['概率最大的主题序号']=topic
      5 data['每个主题对应概率']=list(topics)
      6 data.to_excel("data_topic.xlsx",index=False)

TypeError: list indices must be integers or slices, not str

查了很多LDA相关的代码后,都是这样表达的,还没有找到解决办法 qaq