标签: excel pandas
As you can see in this excel image games,strategy,board in the genres coloumn and games,board strategy is also written in the coloumn.The order of all these genres can be different.What command can I do to treat them as one? I need to plot this data on pandas.Pls help,Any command for pandas or on excel will help.
答案 0 :(得分:0)
如果您不太担心效率。这应该工作。
import pandas as pd df=pd.DataFrame({ 'name':['Game,Strategy,Card,Entertainment','Game,Card,Entertainment,Strategy','Game,Card'] }) df['b']=df['name'].str.split(',').apply(lambda x: sorted(x)).str.join(',') df