Skip to content

Instantly share code, notes, and snippets.

@MLWhiz
Created April 19, 2019 15:31
Show Gist options
  • Save MLWhiz/2389fd65718b5e050726380b8edf4b73 to your computer and use it in GitHub Desktop.
Save MLWhiz/2389fd65718b5e050726380b8edf4b73 to your computer and use it in GitHub Desktop.
def wage_split(x):
try:
return int(x.split("K")[0][1:])
except:
return 0
player_df['Wage'] = player_df['Wage'].apply(lambda x : wage_split(x))
def value_split(x):
try:
if 'M' in x:
return float(x.split("M")[0][1:])
elif 'K' in x:
return float(x.split("K")[0][1:])/1000
except:
return 0
player_df['Value'] = player_df['Value'].apply(lambda x : value_split(x))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment