为什么用bertopic建模时会出现这样的错误,
needed是excel里的文本数据
TypeError Traceback (most recent call last)
Cell In[20], line 1
----> 1 topics,probabilities=topic_model.fit_transform(needed)
File ~\AppData\Roaming\Python\Python310\site-packages\bertopic_bertopic.py:360, in BERTopic.fit_transform(self, documents, embeddings, images, y)
359 if documents is not None:
--> 360 check_documents_type(documents)
361 check_embeddings_shape(embeddings, documents)
363 doc_ids = range(len(documents)) if documents is not None else range(len(images))
File ~\AppData\Roaming\Python\Python310\site-packages\bertopic_utils.py:37, in check_documents_type(documents)
35 if isinstance(documents, Iterable) and not isinstance(documents, str):
36 if not any([isinstance(doc, str) for doc in documents]):
---> 37 raise TypeError("Make sure that the iterable only contains strings.")
39 else:
40 raise TypeError("Make sure that the documents variable is an iterable containing strings only.")
TypeError: Make sure that the iterable only contains strings.