Monday, February 1, 2016

How to filter using numpy

I have two columns"Position_of_all_players" and "Height_of_all_players" of all football players.

"Positions" has values such as "GK","A","M","CM","DM" etc corresponding to the positions of players in a football field. "GK" = Goal Keeper

How do I filter the heights of all the goalkeepers alone.

Height_of_goalkeepers= Height_of_all_players[Position_of_all_players =="GK"]

What if I want to find the heights of all the remaining players?

Height_of_other_players= Height_of_all_players[Position_of_all_players!="GK"]


No comments:

Post a Comment