Use DataFrame.applymap
...
if order is important use split
with dict.fromkeys
for remove duplicates, last join back:
df = df.applymap(lambda x: '-'.join(dict.fromkeys(x.split('-')).keys()))
print (df)
col1 col2
0 1-2-3 1-2-3
1 2-3 4
if order is not important use set
s:
df = df.applymap(lambda x: '-'.join(set(x.split('-'))))
print (df)
col1 col2
0 3-2-1 3-2-1
1 3-2 4
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…