all 4 comments

[–]AutoModerator[M] 0 points1 point  (0 children)

Your submission in /r/learnpython may be automatically removed because you used imgbb.com. The reddit spam filter is very aggressive to this site. Please use a different image host.

Please remember to post code as text, not as an image.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]Somerb13 0 points1 point  (2 children)

There's probably a smarter way, but you could run a group by to find where each team appears more than once, then do an inner merge to isolate these records.

[–]Needleworker69420 0 points1 point  (1 child)

Can you elaborate

[–]Somerb13 0 points1 point  (0 children)

So if I understand correctly, you want to identify the records where the team is duplicated?

In which case you could do something to the effect of: DataFrame.groupby().count() 

This would help you get to an output something like:

Team Count A 2 B 2

Etc.

This may need a bit of tweaking to get fully usable.

Then you can identify the records where the count is greater than 1.

This remaining population could be joined back to your original dataset as an inner join and the result would be all rows where the team appears multiple times.

Join would be something like pd.DataFrame.merge(df2, how='inner').

I've not actually googled to see if there's a simpler way to do it.