共同价值,交叉点,文本数据,数据框架,熊猫
我在Python代码中有一个数据框。我想从数据框架中提取公共阀,并将这些共同值保存在下一列中。我有一列名称文章,并将此列与单词进行比较,并将每个值保存到Python DataFrame中的下一列。
frame1['C'] = [len(set(article).intersection(words)) for article, words in zip(frame1.article, frame1.words)]
给我错误
TypeError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_17260/4070584663.py in <module>
----> 1 frame1['C'] = [len(set(article).intersection(words)) for article, words in zip(frame1.article, frame1.words)]
~\AppData\Local\Temp/ipykernel_17260/4070584663.py in <listcomp>(.0)
----> 1 frame1['C'] = [len(set(article).intersection(words)) for article, words in zip(frame1.article, frame1.words)]
TypeError: 'float' object is not iterable
I have a dataframe in python code. I want to extract the common valves from dataframe and save these common values in next column. I have a column name articles and compare this column with words and save each values to the next column in python dataframe.
frame1['C'] = [len(set(article).intersection(words)) for article, words in zip(frame1.article, frame1.words)]
gives me error
TypeError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_17260/4070584663.py in <module>
----> 1 frame1['C'] = [len(set(article).intersection(words)) for article, words in zip(frame1.article, frame1.words)]
~\AppData\Local\Temp/ipykernel_17260/4070584663.py in <listcomp>(.0)
----> 1 frame1['C'] = [len(set(article).intersection(words)) for article, words in zip(frame1.article, frame1.words)]
TypeError: 'float' object is not iterable
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论