I am doing some EDA on the PUBG data from the Kaggle competition. I would like to convert the common game modes into the standard form Solo, Duo, Squad, Flare and Crash
Here is a list of unique values:
{'flaretpp', 'crashtpp', 'squad-fpp', 'duo-fpp', 'crashfpp', 'normal-squad',
'normal-squad-fpp', 'normal-duo-fpp', 'normal-duo', 'normal-solo', 'squad',
'duo', 'solo-fpp', 'solo', 'normal-solo-fpp', 'flarefpp'}
I basically want to remove the "normal-", "-fpp", "fpp", and "tpp" substring from the values.
I have some code that works, but is very slow (There is approx 4.5M rows). I'm wondering if there is a faster/better way to do this?
for i in range(len(data['matchType'])):
data['matchType'][i] = data['matchType'][i].replace('normal-','')
data['matchType'][i] = data['matchType'][i].replace('-fpp','')
data['matchType'][i] = data['matchType'][i].replace('tpp','')
data['matchType'][i] = data['matchType'][i].replace('fpp','')