I am trying to loop through the "Team" Column and return a slice of the team to remove the number and "-" where it meets a certain condition.
Team Player
0 1-Miami Heat Jimmy Butler
1 2-Boston Celtics Jason Tatum
2 3-Houston Rockets James Harden
I am currently using:
def slice(x):
for elm in x:
if elm[0] == '1' or '2':
return elm[2:]
NBA['Team'] = NBA['Team'].apply(slice)
This is returning an empty value for each team.
I would like to return this:
Team Player
0 Miami Heat Jimmy Butler
1 Boston Celtics Jason Tatum
2 3-Houston Rockets James Harden