Given a DataFrame like this:
Desired outcome:
There are solutions that are close to what I'm looking for using groupby
and count
, but I'm not sure how to get it right. Basically, I want the recommendation that has the highest count for each symbol to be returned. So I assume pseudo code might look something like:
new_df = df.groupby(['Symbol'])['Recommendation'].count().max()
...but of course this is wrong.