【发布时间】:2017-04-05 20:17:14
【问题描述】:
大家好,我有一个数据框,其内容类似于
name,mv_str
abc,Exorsist part1
abc,doc str 2D
abc,doc str 3D
abc,doc str QA
abc,doc flash
def,plastic
def,plastic income
def,doc str 2D ###i added this row for better clarity
我预期的 o/p 应该有 .... 每组在某种意义上获得唯一的记录行——对于每个 mailid mv_str 不应该是相似的类型 i:e 来自一个 'mv_str' 的第一个 2 个单词不应该在那里在该特定用户名的第二行/任何行中。
注意:应按用户名级别进行比较。
name,mv_str
abc,Exorist part1
abc,doc str 2D ###3D and QA removes as 1st 2 words "doc str" matched
abc, doc flash ###only 1st word is matching, 2nd word does not
def,plastic
def,plastic income #It should be present as only one word is matching
def,doc str 2D ###this row should be there as this is for another User
请任何人帮助我形成逻辑,否则代码示例将是很好的帮助。谢谢。
【问题讨论】:
标签: python string pandas group-by duplicates