【发布时间】:2020-02-10 07:41:21
【问题描述】:
ProArticle Vector
0 Iran jails blogger 14 years An Iranian weblogg... [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, ...
1 UK gets official virus alert site A rapid aler... [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, ...
2 OSullivan could run Worlds Sonia OSullivan ind... [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, ...
3 Mutant book wins Guardian prize A book evoluti... [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, ...
4 Microsoft seeking spyware trojan Microsoft inv... [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, ...
以上是来自矢量化新闻文章的 data.head() sn-p。
type(data.Vector[0]) 是list
我需要对这个矢量化数据使用 KMeans 聚类,但列表不允许我这样做。
data.Vector.shape 是 179,data.Vector[0].shape 是 8868。
如何删除列表,或者如果我不能,那么如何使用它对给定数据进行聚类?也许我可以通过以下方式获得一个数据框,然后在其上运行 PCA。
【问题讨论】:
-
请包括预期输出。是否要将
Vector和ProArticle的每个元素拆分为单独的行? -
我已经添加了预期的输出。
-
看this
标签: python pandas list machine-learning k-means