句子列表中的维恩图
我在 Excel 中的每一行的一列中都有一个包含许多句子的列表。我有大约 3 或更多的专栏有这样的句子。其中有一些常用的句子。是否可以创建一个脚本来创建维恩图并获取所有图之间的共同点。
示例:这些是一栏中的句子。同样,也有不同的列。
来自癌症的血液淋巴细胞
来自患者的血液淋巴细胞
卵巢肿瘤_III级
腹膜肿瘤_IV级
激素抵抗PCA
可以用Python编写脚本吗?
I have a list of many sentences in Excel on each row in a column. I have like 3 or more columns with such sentences. There are some common sentences in these. Is it possible to create a script to create a Venn diagram and get the common ones between all.
Example: These are sentences in a column. Similarly there are different columns.
Blood lymphocytes from cancer
Blood lymphocytes from patients
Ovarian tumor_Grade III
Peritoneum tumor_Grade IV
Hormone resistant PCA
Is it possible to write a script in python?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是我对问题的解释...
给出数据文件 z.csv (将数据从 Excel 导出到 csv 文件)
该程序找到所有列共有的句子
它打印这个答案
不能 100% 确定这是什么您正在寻找,但希望它可以帮助您开始!
它可以很容易地推广到您喜欢的任意多的列,但我不想让它变得更复杂
This is my interpretation of the question...
Give the data file z.csv (export your data from excel into a csv file)
This program finds the sentences common to all the columns
And it prints this answer
Not 100% sure that is what you are looking for but hopefully it gets you started!
It could be generalised easily to as many columns as you like, but I didn't want to make it more complicated
你的问题不完全清楚,所以我可能误解你在寻找什么。
维恩图只是一些简单的集合运算。 Python 将这些内容内置到 Set 数据类型中。基本上,获取两组项目并使用集合操作(例如使用
交集
来查找公共项目)。要读取数据,最好的选择可能是将文件保存为 CSV 格式,然后使用字符串
split
方法对其进行解析。Your question is not fully clear, so I might be misunderstanding what you're looking for.
A Venn diagram is just a few simple Set operations. Python has this stuff built into the Set datatype. Basically, take your two groups of items and use set operations (e.g. use
intersection
to find the common items).To read in the data, your best bet is probably to save the file in CSV format and just parse it with the string
split
method.