-
-
Save amankharwal/c5e3897cb608c5b8ac7da73453fb8460 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
df.Rank = df.Rank.apply(lambda x: int(x.split("#")[1]) if type(x) == np.str else x) | |
df.Pay = df.Pay.apply(lambda x: float(x.split(" ")[0].split("$")[1])) | |
df.Endorsements = df.Endorsements.apply(lambda x: float(x.split(" ")[0].split("$")[1])) | |
df["Salary/Winnings"].replace("-",'$nan M',inplace=True) | |
df["Salary/Winnings"] = df["Salary/Winnings"].apply(lambda x: float(x.split(" ")[0].split("$")[1])) | |
df.Sport.replace({"Soccer":"Football", | |
"Football":"American Football", | |
"Mixed Martial Arts":"MMA", | |
"Auto racing":"Racing", | |
"Auto Racing":"Racing", | |
"Basketbal":"Basketball", | |
},inplace=True) | |
df.columns = ['Rank', 'Name', 'Pay', 'Salary_Winnings', 'Endorsements', 'Sport', 'Year'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment