Skip to content

Instantly share code, notes, and snippets.

Created Dec 21, 2020
What would you like to do?
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]))
"Football":"American Football",
"Mixed Martial Arts":"MMA",
"Auto racing":"Racing",
"Auto Racing":"Racing",
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