Search code examples
pythonpandasdataframepandas-groupby

How can I group by in a dataframe?


I have a dataframe in which I have details of manager and its lead sources(Google, website, Mobile app). I need to find count per manager how many leads he got from different sources in pandas.

I tried using group-by but I am not able to find the count of lead source per Manager


Solution

  • You can try something like this:

    df.groupby(by="ManagerName").sum()